I had a look at model 47, where we want to estimate the parameters of the determistic age profile of earnings.
Labor earnings in the model are defined as
where h is hours worked, z is an exogenous shock to labor productivity, \kappa_j is an age-dependent parameter and w is wage per efficiency units.
We can parametrize \kappa_j as a low degree polynomial and estimate the coefficients of the polynomial to match some appropriate data targets.
The code in model 47 uses a special function to do this, reported below:
function Params=LifeCycleModel47_ParametrizeKappajFn(Params)
agevec=(Params.agejshifter+Params.agej)/100; % real world ages (this just seems a nicer thing to put the polynomial on, rather than model period; easier to relate to data work)
% log(kappa_j) is a fifth-order polynomial in age (actually, age divided by 100, as otherwise the polynomial just gives
% numbers so large that when we take the exponential they blow up)
Params.kappa_j=exp(Params.kappa_j_c0+Params.kappa_j_c1*agevec+Params.kappa_j_c2*agevec.^2+Params.kappa_j_c3*agevec.^3+Params.kappa_j_c4*agevec.^4+Params.kappa_j_c5*agevec.^5);
% Note: in the estimation we require that kappa_j is positive, and by
% making log(kappa_j) a polynomial, rather than making kappa_j a
% polynomial, we ensure that kappa_j is alway positive.
end
Why bother doing this and not simply estimating the coefficients of the polynomial together with the other parameters? I can easily add the code of LifeCycleModel47_ParametrizeKappajFn to f_ReturnFn and define kappa_j_c0, kappa_j_c1, etc as additional parameters in the return function, as follows:
function F=LifeCycleModel45_ReturnFn(h,aprime,a,z,w,sigma,psi,eta,agej,Jr,pension,r,kappa_j_c0,kappa_j_c1,kappa_j_c2,kappa_j_c3,kappa_j_c4,kappa_j_c5,agejshifter)
age=(agejshifter+agej)/100;
kappa_j=exp(kappa_j_c0+kappa_j_c1*age+kappa_j_c2*age^2+kappa_j_c3*age^3+kappa_j_c4*age^4+kappa_j_c5*age^5);
F=-Inf;
if agej<Jr % If working age
c=w*kappa_j*z*h+(1+r)*a-aprime; % Add z here
else % Retirement
c=pension+(1+r)*a-aprime;
end
if c>0
F=(c^(1-sigma))/(1-sigma) -psi*(h^(1+eta))/(1+eta); % The utility function
end
end %end function