REPRO-Bench / 16 /replication_package /programs /shortjobs_structural.m
anonymous-submission-acl2025's picture
add 16
b4ae6c9
clc;
clear all;
close all;
%% Set values for parameters that never change
global pigrdpts pigrid pigriddiv yb yg beta b gam eta pkh lam alph pi0 kh sigeps A kr
% grid for \pi
pigrdpts=1500;
pigrdwidth=1/pigrdpts;
pilo=0;
pihi=1;
% values of pigrid represent the "midpoint" of a particular gridpoint, and
% values pigriddiv represent the "dividing point" between two successive
% gridpoints.
pigriddiv=(pilo:pigrdwidth:pihi); % dividing points between gridpoint ranges
pigrid=(pilo+pigrdwidth/2:pigrdwidth:pihi-pigrdwidth/2);
yb=.4; % productivity of bad match
yg=1; % productivity of good match
beta=.96^(1/52); % 4 percent annual discount rate (period is a week)
b=.4; % flow value of leisure
gam=0.5; % elasticity of matches wrt unemp
eta=0.5; % workers' barg power
pkh=1/52; % hazard rate for ending of start-up costs
options=optimset('TolFun',1e-12,'Display','none'); % set convergence tolerance for fsolve
% parameters in 'solvemodel' function that we will want to access in this program
global pe pf u e0 e1 w0 w1 tendist probmatch probg H_pi_dist pibar theta oneqhazrate twoqhazrate threeplushazrate hiresrate jfr meanvacdur
%% % Baseline results with pi0=0.40 (results for pi0=0.38, shown in the
% Appendix, are derived further below)
% Exercises that hold pi0 and kh fixed
pi0=0.4; % prior that y=y_g
kh=0.11; % training/start-up costs
% 1999 calibration
alph=0.146;
lam=0.0085;
startvals=[0.809; 0.232; 0.813]; % starting values for [sigeps; A; kr] (chosen here with knowledge of solution, based on having previously solved)
targets=[0.419; 0.486; 22.7/7]; % targeted values for probg, jfr, and meanvacdur (1999)
[Params1999, fval]=fsolve(@(x) solvemodel(x, targets, 1, 0), startvals, options);
% reveal the calibrated 1999 values of sigeps, A, and kr
Params1999
disp('Calculations for Table 4')
% % Table 4: The model's 1999 moments are calculated and displayed here
% 1999 values of model moments
disp('1999 values of model moments')
stats1999=[oneqhazrate twoqhazrate threeplushazrate hiresrate jfr meanvacdur u]
% 2017 calibration
alph=0.124;
lam=0.0068;
startvals=[0.555; 0.197; 0.951]; % starting values for sigeps, A, and kr
targets=[0.463; 0.364; 28.1/7]; % targeted values for probg, jfr, and meanvacdur (2017)
disp('Calculations for Table 5')
% Solve for parameters
[Params2017a, fval]=fsolve(@(x) solvemodel(x, targets, 1, 0), startvals, options);
% reveal the calibrated 2017 values of sigeps, A, and kr
disp('Calibrated values of sigeps, A, and kr:')
Params2017a
% show the 2017 model moments
disp('2017 values of model moments:')
stats2017=[oneqhazrate twoqhazrate threeplushazrate hiresrate jfr meanvacdur u]
disp('Calculations for Table 6')
% % Table 6 results: The following code shows (changes in) the statistics of
% interest for the decompositions that change parameters one at a time to
% their 2017 values
alph=0.146; % set alph back to its 1999 value
lam=0.0085; % set lam back to its 1999 value
% change kr
solvemodel([Params1999(1); Params1999(2); Params2017a(3)],targets, 1, 0);
stats2017=[oneqhazrate twoqhazrate threeplushazrate hiresrate jfr meanvacdur u];
disp('Changes due to change in kr:')
stats2017-stats1999
% change A
solvemodel([Params1999(1); Params2017a(2); Params1999(3)],targets, 1, 0);
stats2017=[oneqhazrate twoqhazrate threeplushazrate hiresrate jfr meanvacdur u];
disp('Changes due to change in A:')
stats2017-stats1999
% change lam
lam=0.0068;
solvemodel(Params1999, targets, 1, 0);
lam=0.0085; % restore to 1999 value
stats2017=[oneqhazrate twoqhazrate threeplushazrate hiresrate jfr meanvacdur u];
disp('Changes due to change in lam:')
stats2017-stats1999
% change alph
alph=0.124;
lam=0.0085;
solvemodel(Params1999, targets, 1, 0);
alph=0.146; % restore to 1999 value
stats2017=[oneqhazrate twoqhazrate threeplushazrate hiresrate jfr meanvacdur u];
disp('Changes due to change in alph:')
stats2017-stats1999
% change sigeps
solvemodel([Params2017a(1); Params1999(2); Params1999(3)],targets, 1, 0);
stats2017=[oneqhazrate twoqhazrate threeplushazrate hiresrate jfr meanvacdur u];
disp('Changes due to change in sigeps:')
stats2017-stats1999
%% Exercises that hold sigeps and kh fixed
% Note that there is no need here to re-do anything for the 1999
% calibration. These exercises are just re-doing the 2017 calibration under
% the assumption that now pi0, rather than sigeps, is allowed to vary.
sigeps=0.8088; % fix this at the 1999 calibrated value
kh=0.11;
% 2017 calibration
alph=0.124;
lam=0.0068;
startvals=[0.452; 0.169; 0.951]; % starting values for pi0, A, and kr
targets=[0.463; 0.364; 28.1/7]; % targeted values for probg, jfr, and meanvacdur (2017)
% Solve for parameters, and show the 2017 model moments
[Params2017b, fval]=fsolve(@(x) solvemodel(x, targets, 2, 0), startvals, options); % note: the third argument here is 2, indicating that the three free parameters are pi0, A, and kr
disp('Calculations for Table 7')
% reveal the calibrated 2017 values of pi0, A, and kr
disp('Calibrated values of pi0, A, and kr:')
Params2017b
disp('2017 values of model moments:')
stats2017=[oneqhazrate twoqhazrate threeplushazrate hiresrate jfr meanvacdur u]
% % Table 7 results: The following code shows (changes in) the statistics of
% interest for the decompositions that change parameters one at a time to
% their 2017 values
alph=0.146; % set alph back to its 1999 value
lam=0.0085; % set lam back to its 1999 value
% note: here the first parameter is pi0, so need to set it to its 1999 value
% of 0.4
% change kr
solvemodel([0.4; Params1999(2); Params2017b(3)],targets, 2, 0);
stats2017=[oneqhazrate twoqhazrate threeplushazrate hiresrate jfr meanvacdur u];
disp('Changes due to change in kr:')
stats2017-stats1999
% change A
solvemodel([0.4; Params2017b(2); Params1999(3)],targets, 2, 0);
stats2017=[oneqhazrate twoqhazrate threeplushazrate hiresrate jfr meanvacdur u];
disp('Changes due to change in A:')
stats2017-stats1999
% change lam
lam=0.0068;
solvemodel([0.4; Params1999(2); Params1999(3)], targets, 2, 0);
lam=0.0085; % restore to 1999 value
stats2017=[oneqhazrate twoqhazrate threeplushazrate hiresrate jfr meanvacdur u];
disp('Changes due to change in lam:')
stats2017-stats1999
% change alph
alph=0.124;
lam=0.0085;
solvemodel([0.4; Params1999(2); Params1999(3)], targets, 2, 0);
alph=0.146; % restore to 1999 value
stats2017=[oneqhazrate twoqhazrate threeplushazrate hiresrate jfr meanvacdur u];
disp('Changes due to change in alph:')
stats2017-stats1999
% change pi0
solvemodel([Params2017b(1); Params1999(2); Params1999(3)],targets, 2, 0);
stats2017=[oneqhazrate twoqhazrate threeplushazrate hiresrate jfr meanvacdur u];
disp('Changes due to change in pi0:')
stats2017-stats1999
%% Exercises that hold pi0 and kr fixed
pi0=0.4;
kr=.8141; % fix this at the 1999 calibrated value
% 2017 calibration
alph=.124;
lam=.0068;
startvals=[0.650; 0.202; 0.345]; % starting values for sigeps, A, and kh
targets=[.463; .364; 28.1/7];
[Params2017c, fval]=fsolve(@(x) solvemodel(x, targets, 3, 0), startvals, options); % note: the third argument here is 3, indicating that the three free parameters are pi0, A, and kh
disp('Calculations for Table 8')
% reveal the calibrated 2017 values of sigeps, A, and kh
disp('Calibrated values of sigeps, A, and kh:')
Params2017c
disp('2017 values of model moments:')
stats2017=[oneqhazrate twoqhazrate threeplushazrate hiresrate jfr meanvacdur u]
% % Table 8 results: The following code shows (changes in) the statistics of
% interest for the decompositions that change parameters one at a time to
% their 2017 values
alph=0.146; % set alph back to its 1999 value
lam=0.0085; % set lam back to its 1999 value
% note: here the third parameter is kh, so need to set it to its 1999 value
% of 0.11 (except for the exercise where it is being changed)
% change kh
solvemodel([Params1999(1); Params1999(2); Params2017c(3)], targets, 3, 0);
stats2017=[oneqhazrate twoqhazrate threeplushazrate hiresrate jfr meanvacdur u];
disp('Changes due to change in kh:')
stats2017-stats1999
% change A
solvemodel([Params1999(1); Params2017c(2); 0.11],targets, 3, 0);
stats2017=[oneqhazrate twoqhazrate threeplushazrate hiresrate jfr meanvacdur u];
disp('Changes due to change in A:')
stats2017-stats1999
% change lam
lam=0.0068;
solvemodel([Params1999(1); Params1999(2); 0.11], targets, 3, 0);
lam=0.0085; % restore to 1999 value
stats2017=[oneqhazrate twoqhazrate threeplushazrate hiresrate jfr meanvacdur u];
disp('Changes due to change in lam:')
stats2017-stats1999
% change alph
alph=0.124;
lam=0.0085;
solvemodel([Params1999(1); Params1999(2); 0.11], targets, 3, 0);
alph=0.146; % restore to 1999 value
stats2017=[oneqhazrate twoqhazrate threeplushazrate hiresrate jfr meanvacdur u];
disp('Changes due to change in alph:')
stats2017-stats1999
% change sigeps
solvemodel([Params2017c(1); Params1999(2); 0.11],targets, 3, 0);
stats2017=[oneqhazrate twoqhazrate threeplushazrate hiresrate jfr meanvacdur u];
disp('Changes due to change in sigeps:')
stats2017-stats1999
%% Appendix. Re-do the exercises, but with a baseline value of pi0=0.38 (version of model in which sigeps, A, and kr can change)
disp('Calculations for the table in the Appendix')
pi0=0.38; % prior that y=y_g
kh=0.11; % training/start-up costs
% 1999 calibration
alph=0.146;
lam=0.0085;
startvals=[0.691; 0.249; 0.813]; % starting values for [sigeps; A; kr] (chosen here with knowledge of solution, based on having previously solved)
targets=[0.419; 0.486; 22.7/7]; % targeted values for probg, jfr, and meanvacdur (1999)
[Params1999b, fval]=fsolve(@(x) solvemodel(x, targets, 1, 0), startvals, options);
% reveal the calibrated 1999 values of sigeps, A, and kr
Params1999b
% 1999 values of model moments
disp('1999 values of model moments')
stats1999=[oneqhazrate twoqhazrate threeplushazrate hiresrate jfr meanvacdur u]
% 2017 calibration
alph=0.124;
lam=0.0068;
startvals=[0.515; 0.210; 0.951]; % starting values for sigeps, A, and kr
targets=[0.463; 0.364; 28.1/7]; % targeted values for probg, jfr, and meanvacdur (2017)
% Solve for parameters, and show the 2017 model moments
[Params2017d, fval]=fsolve(@(x) solvemodel(x, targets, 1, 0), startvals, options);
% reveal the calibrated 2017 values of sigeps, A, and kr
disp('Calibrated values of sigeps, A, and kr:')
Params2017d
disp('2017 values of model moments:')
stats2017=[oneqhazrate twoqhazrate threeplushazrate hiresrate jfr meanvacdur u]
% % Panel B: The following code shows (changes in) the statistics of
% interest for the decompositions that change parameters one at a time to
% their 2017 values
alph=0.146; % set alph back to its 1999 value
lam=0.0085; % set lam back to its 1999 value
% change kr
solvemodel([Params1999b(1); Params1999b(2); Params2017d(3)],targets, 1, 0);
stats2017=[oneqhazrate twoqhazrate threeplushazrate hiresrate jfr meanvacdur u];
disp('Changes due to change in kr:')
stats2017-stats1999
% change A
solvemodel([Params1999b(1); Params2017d(2); Params1999b(3)],targets, 1, 0);
stats2017=[oneqhazrate twoqhazrate threeplushazrate hiresrate jfr meanvacdur u];
disp('Changes due to change in A:')
stats2017-stats1999
% change lam
lam=0.0068;
solvemodel(Params1999b, targets, 1, 0);
lam=0.0085; % restore to 1999 value
stats2017=[oneqhazrate twoqhazrate threeplushazrate hiresrate jfr meanvacdur u];
disp('Changes due to change in lam:')
stats2017-stats1999
% change alph
alph=0.124;
lam=0.0085;
solvemodel(Params1999b, targets, 1, 0);
alph=0.146; % restore to 1999 value
stats2017=[oneqhazrate twoqhazrate threeplushazrate hiresrate jfr meanvacdur u];
disp('Changes due to change in alph:')
stats2017-stats1999
% change sigeps
solvemodel([Params2017d(1); Params1999b(2); Params1999b(3)],targets, 1, 0);
stats2017=[oneqhazrate twoqhazrate threeplushazrate hiresrate jfr meanvacdur u];
disp('Changes due to change in sigeps:')
stats2017-stats1999
%% Calculate mean wages at different tenure
% Before running the code that calculates average wages, we
% first need to solve a version of the model, so as to determine the
% equilibrium values of the variables needed to calculate those averages
% wages, such as probmatch, pe, pf, etc.
disp('Calculations for section 5.5')
% Calculations in third paragraph of section 5.5
disp('Third paragraph')
pi0=0.4; % reset to value from baseline parameterization.
% % 1999
alph=0.146; lam=0.0085;
solvemodel(Params1999, targets, 1, 0);
calculate_mean_wages
q1wages1999=mean_wages_first_qtr;
y5wages1999=mean_wages_fifth_year;
% % 2017
alph=0.124; lam=0.0068;
solvemodel(Params2017a, targets, 1, 0);
calculate_mean_wages
q1wages2017=mean_wages_first_qtr;
y5wages2017=mean_wages_fifth_year;
disp('Percentage change in first-quarter mean wages')
q1wages2017/q1wages1999-1
disp('Percentage change in first-quarter/fifth-year ratio')
(q1wages2017/y5wages2017)/(q1wages1999/y5wages1999)-1
% Calculations for fourth paragraph of section 5.5
disp('Fourth paragraph')
% % 2017 value for sigeps, 1999 for all others
alph=0.146; lam=0.0085;
solvemodel([Params2017a(1); Params1999(2); Params1999(3)], targets, 1, 0);
calculate_mean_wages
q1wages2017=mean_wages_first_qtr;
y5wages2017=mean_wages_fifth_year;
disp('Percentage change in first-quarter mean wages')
q1wages2017/q1wages1999-1
disp('Percentage change in first-quarter/fifth-year ratio')
(q1wages2017/y5wages2017)/(q1wages1999/y5wages1999)-1
% Calculations for fifth paragraph of section 5.5
solvemodel(Params2017c, targets, 3, 0);
calculate_mean_wages
disp('first-quarter wages in 1999')
q1wages1999
disp('first-quarter wages in 2017')
q1wages2017=mean_wages_first_qtr
disp('Percentage change in first-quarter mean wages')
round(q1wages2017,3)/round(q1wages1999,3)-1
disp('fifth-year wages in 1999')
round(y5wages1999,3)
disp('fifth-year wages in 2017')
y5wages2017=mean_wages_fifth_year;
round(y5wages2017,3)
disp('Percentage change in fifth-year mean wages')
round(y5wages2017,3)/round(y5wages1999,3)-1