src/equilibrium.m [149:229]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    end
    
    
    
    
    % Find equilibrium SH wage
	params = [sh_intercept,sh_demand_e,sh_lh_response,fe_long,fe_short,fe_other,wage_supply_e,lf];
    w0 = 10000;
    if stop_feedback == 0
        f = @(w) excess_demand_sh(w,LH_wage,O_wage,lh_employment,params);
    end
    if stop_feedback == 1
        f = @(w) excess_demand_sh(w,LH_wage,O_wage,stop_feedback_lhe,params);
    end
    SH_wage = fmincon(f,w0);

    
    % Get SH employment
    if stop_feedback == 0
        sh_employment = sh_demand(SH_wage,lh_employment,params)
    end
    if stop_feedback == 1
        sh_employment = sh_demand(SH_wage,stop_feedback_lhe,params)
    end
    
    % Check if converged and don't let SH wage go above 60,000 
    % (this is the point whhere LH labor supply has switched entirely to SH)
    step = (LH_wage - LH_wage_lagged)^2 + (SH_wage - SH_wage_lagged)^2;
    if  step <= 0.001
        if SH_wage > 60000 & stop_feedback == 0
            stop_feedback = 1;
            stop_feedback_lhe = lh_employment;
        end
    end
    LH_wage_lagged = (LH_wage + LH_wage_lagged + LH_wage_lagged )/3
    SH_wage_lagged = (SH_wage + SH_wage_lagged + SH_wage_lagged )/3
    
    % calculate elasticity of supply at baseline
    % uncomment this part to do the calculation
    %if year == 1
    %    supply_share_1 = exp(fe_long + log(LH_wage)*wage_supply_e)/ ...
    %               (1+exp(fe_short + log(SH_wage)*wage_supply_e)+ ...
    %               exp(fe_long + log(LH_wage)*wage_supply_e)+ ...
    %               exp(fe_other + log(O_wage)*wage_supply_e));
    %    supply_share_2 = exp(fe_long + log(LH_wage+10000)*wage_supply_e)/ ...
    %               (1+exp(fe_short + log(SH_wage)*wage_supply_e)+ ...
    %               exp(fe_long + log(LH_wage+10000)*wage_supply_e)+ ...
    %               exp(fe_other + log(O_wage)*wage_supply_e));
    %    D_supply = (supply_share_2 - supply_share_1)*lf;
    %    D_wage = 10000;
    %    elasticity = (D_supply/D_wage)*(LH_wage/(supply_share_1*lf));
    %end
    
    
    
end

output(year,1) = scenario;
output(year,2) = multi;

output(year,3) = 2016+year;
output(year,4) = LH_wage;
output(year,5) = SH_wage;
output(year,6) = lh_employment_true;
output(year,7) = sh_employment

end



% save lh wages, lh and sh employment for each year
% after end of loop, plot and output to csv

if scenario == 1 & multi == 2
out = output;
else
out = [out;output];
end

end
end
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



src/equilibrium_with_growth.m [151:229]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    end
    
    
    % Find equilibrium SH wage
	params = [sh_intercept,sh_demand_e,sh_lh_response,fe_long,fe_short,fe_other,wage_supply_e,lf];
    w0 = 10000;
    if stop_feedback == 0
        f = @(w) excess_demand_sh(w,LH_wage,O_wage,lh_employment,params);
    end
    if stop_feedback == 1
        f = @(w) excess_demand_sh(w,LH_wage,O_wage,stop_feedback_lhe,params);
    end
    SH_wage = fmincon(f,w0);

    
    % Get SH employment
    if stop_feedback == 0
        sh_employment = sh_demand(SH_wage,lh_employment,params)
    end
    if stop_feedback == 1
        sh_employment = sh_demand(SH_wage,stop_feedback_lhe,params)
    end
    
    % Check if converged and don't let SH wage go above 60,000 
    % (this is the point whhere LH labor supply has switched entirely to SH)
    step = (LH_wage - LH_wage_lagged)^2 + (SH_wage - SH_wage_lagged)^2;
    if  step <= 0.001
        if SH_wage > 60000 & stop_feedback == 0
            stop_feedback = 1;
            stop_feedback_lhe = lh_employment;
        end
    end
    LH_wage_lagged = (LH_wage + LH_wage_lagged + LH_wage_lagged )/3
    SH_wage_lagged = (SH_wage + SH_wage_lagged + SH_wage_lagged )/3
    
    % calculate elasticity of supply at baseline
    % uncomment this part to do the calculation
    %if year == 1
    %    supply_share_1 = exp(fe_long + log(LH_wage)*wage_supply_e)/ ...
    %               (1+exp(fe_short + log(SH_wage)*wage_supply_e)+ ...
    %               exp(fe_long + log(LH_wage)*wage_supply_e)+ ...
    %               exp(fe_other + log(O_wage)*wage_supply_e));
    %    supply_share_2 = exp(fe_long + log(LH_wage+10000)*wage_supply_e)/ ...
    %               (1+exp(fe_short + log(SH_wage)*wage_supply_e)+ ...
    %               exp(fe_long + log(LH_wage+10000)*wage_supply_e)+ ...
    %               exp(fe_other + log(O_wage)*wage_supply_e));
    %    D_supply = (supply_share_2 - supply_share_1)*lf;
    %    D_wage = 10000;
    %    elasticity = (D_supply/D_wage)*(LH_wage/(supply_share_1*lf));
    %end
    
    
    
end

output(year,1) = scenario;
output(year,2) = multi;

output(year,3) = 2016+year;
output(year,4) = LH_wage;
output(year,5) = SH_wage;
output(year,6) = lh_employment_true;
output(year,7) = sh_employment

end



% save lh wages, lh and sh employment for each year
% after end of loop, plot and output to csv

if scenario == 1 & multi == 2
out = output;
else
out = [out;output];
end

end
end
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



