Content:
This folder contains the programs used to solve the model under the assumption that the TFP growth rate has a 
stochastic trend.

--------------------------------------------------------------------------
1. init_guess 
--------------------------------------------------------------------------
!!!!!!!!! You can skip this step since the initial guess already exists. 

This file computes the guess used to initialize the solution algorithm in 'master_file_solution_feb24'.

- Outputs (stored in the folder 'Outputs')
  1) LFPWBrestrictedsupport_uniform_Legendre_15x15x15x15_cy_0pt73_rn_1pt5_beta_0pt9982_xilb_0pt_xiub_3pt.mat  
              --> initial guess and calibration
  2) spreadsheet named '15x15x15x15_uniform' in xls file named 'moments'   
              --> simulation moments and accuracy indicators for each of these economies 

- Intputs: calibration (stored in folder 'Inputs')

--------------------------------------------------------------------------
2. master_file_solution_feb24: main program to run (time: 8h31)
--------------------------------------------------------------------------

- Outputs (stored in the folder 'Outputs'):

  1) LFPWBrestrictedsupport_uniform_Legendre_40x40x40x40_cy_0pt73_rn_1pt5_beta_0pt9982_xilb_0pt_xiub_3pt.mat  
        --> solution and simulated data 
  2) spreadsheet named '40x40x40x40_uniform' in xls file named 'moments'   
        --> simulation moments and accuracy indicators 

- Intputs
  1) LFPWBrestrictedsupport_uniform_Legendre_15x15x15x15_cy_0pt73_rn_1pt5_beta_0pt9982_xilb_0pt_xiub_3pt.mat
         --> initial guess and calibration
     
- Functions called by the program:
  equations_oc_LFPWB.m                        --> model equations / computes endogenous varibales as well as 
                                                  the values of the inflation rate and of the output gap implied by
                                                  the system of equations (new guesses)
  simulate_oc_LFPWB.m                         --> generates (simulated) data, compute simulation moments, compute accuracy indicators
  invtsncdf.m                                 --> Computes the inverse of the truncated standard normal cumulative distribution function       
  Grid_uniform.m                              --> constructs an 'evenly spaced' grid                    
  Policy_function_iteration.m                 --> solution algorithm                  
  compute_duration_ELB.m                      --> computes the average duration of a ZLB episode                                                                                    
  
- Other functions (not in the folder 'Functions'):
  qnwnorm                                     --> generates the (Gauss-Hermite) quadrature nodes and weights for computing the expectations of functions 
                                                  of normal random variates; in CompEcon toolbox 
  qnwlege                                     --> generates the (Gauss-Legendre) quadrature nodes and weights for computing a numerical integral on
                                                  a bounded interval; in CompEcon toolbox 

- Robustness check: alternative grid  
  
  1) disable these three command lines:
     grid_type             = 'uniform';
     construct_grid        = @Grid_uniform;
     excsheet              = '40x40x40x40_uniform';

  2) enable these three command lines:
     grid_type             = 'adaptative_density';
     construct_grid        = @Grid_adaptative_density3;   --> the function 'Grid_adaptative_density3.m' constructs an 'adaptative' grid
     excsheet              = '40x40x40x40_adaptative'; 

  3) Recommended (computing time of about 4.30 hours)
     disable this command:
     fname     = 'Outputs/LFPWBrestrictedsupport_uniform_Legendre_15x15x15x15_cy_0pt73_rn_1pt5_beta_0pt9982_xilb_0pt_xiub_3pt';
     enable this command:
     fname     = 'Outputs/LFPWBrestrictedsupport_uniform_Legendre_40x40x40x40_cy_0pt73_rn_1pt5_beta_0pt9982_xilb_0pt_xiub_3pt';

  4) Recommended (to avoid cluttering your hard drive): change dummy_save = 0 instead of 1

  Output: 
  1) spreadsheet named '40x40x40x40_adaptative' in xls file named 'moments'   --> simulation moments and accuracy indicators 

  Other outputs (if you kept dummy_save = 1)
  1) LFPWBrestrictedsupport_adaptative_density_Legendre_40x40x40x40_cy_0pt73_rn_1pt5_beta_0pt9982_xilb_0pt_xiub_3pt.mat
         --> solution and simulated data

--------------------------------------------------------------------------
3. impulse_responses
--------------------------------------------------------------------------
This file computes the impulse response functions used to produce the different figures and stores them
into LFPWBrestrictedsupport_uniform_Legendre_40x40x40x40_cy_0pt73_rn_1pt5_beta_0pt9982_xilb_0pt_xiub_3pt.mat

- Inputs:
  1) LFPWBrestrictedsupport_uniform_Legendre_40x40x40x40_cy_0pt73_rn_1pt5_beta_0pt9982_xilb_0pt_xiub_3pt.mat  
        --> model solution and simulated data

- Functions called by the program:
  irf_oc_LFPWB_det.m      --> computes deterministic impulse responses to transitory or/and permanent 
                              real rate shocks
  irf_oc_LFPWB_new.m      --> computes the "mean dynamics" in response to shocks, i.e., the average response
                              over a certain number of stochastic simulations 

-----------------------------------------------------------------------------------------------
4. welfare_analysis (computing time: about 83 hours with university computer - less powerful)
-----------------------------------------------------------------------------------------------

This file computes the unconditional welfare loss based on two indicators (see appendix) and stores them into 
LFPWBrestrictedsupport_uniform_Legendre_40x40x40x40_cy_0pt73_rn_1pt5_beta_0pt9982_xilb_0pt_xiub_3pt.mat

- Inputs:
  1) LFPWBrestrictedsupport_uniform_Legendre_40x40x40x40_cy_0pt73_rn_1pt5_beta_0pt9982_xilb_0pt_xiub_3pt.mat  
        --> model solution and simulated data


- Functions called by the program:
  sim_welfare_loss2.m                   --> computes the unconditional welfare loss (L-bar in the appendix)
  recursion_welfare_loss_oc_LFPWB.m     --> computes the welfare loss for all nodes in the discretized state space by using a time iteration approach
  sim_welfare_loss_rec.m                --> computes the unconditional welfare loss (W-bar in the appendix)



