Bayesian Estimation and Steady State Updating


#1

Hello,

I have a general question concerning bayesian estimation:

Suppose I would like to estimate the parameters of a DSGE model and in particular the disount factor betta. Since I loglinearize my model, the steady state interest rate Rss shows up in the model part as parameter. I know that in the steady state Rss=1.0/betta, which is written down in the parameters block. During the MCMC run, Dynare draws many different values for betta. My question now is whether Rss is updated each draw as well or whether it is held constant all the time (and equal its initial steady state value).

In case it is not updated, could I fix this problem only by using an external steady state file?

In case it is updated, is it nevertheless a good idea to use an external steady state file because it is always faster? (I.e. is it faster to use an external steady state file although I have solved for the whole steady state analytically in the parameters block?)

I am thankful for any help,
best wishes,
Niklas


Bayesian steady state measurement error
Error in interation:Impossible to find the steady state
Why is _steadystate.m important when estimating a model
Estimation RBC stochastic model
Problems with identification for a SMOE (As in Gali ch. 7)
#2

No, parameters defined before the model-block are not updated during estimation. Hence, you should either use a steady state file or use the pound operator. If your model is loglinearized, the overhead of the steady state file is not ideal. Hence, I would recommend using Expressions.

You could for example add to the model-block

and use Rss in the model as before. When estimating betta, Dynare will update this expression for Rss in dependence on betta. I hope this helps.


#3

Dear jpfeifer,

as always thank you very much! This helps!

One question concerning the speed of computation (What do you mean exactly by “overhead of the steady state file” in this context?):
If I have a large DSGE model, NOT log-linearized, where the steady state is currently calculated in the parameters block, what is faster when it comes to estimation: Computing the steady state using the pound operator (although this could get very messy) or using an external steady state file?

All the best,
Niklas


#4

An external steady state file is clearly the fastest implementation.


#5

Dear jpfeifer and Niklas,

I did not manage to update the steady-state when I estimate the model.
I added after “model(linear)” the definition of
#Rss=1/betta;
But I get an error message: Rss has wrong type, you cannot use it within as left-hand side of a pound (’#’) expression

In the code I first declared R_ss as a parameter, then I have inserted its definition with the pound operator in front of it (after “model(linear)”). I am using dynare version 4.2.4. How can I update the steady state correctly?

You help (also an example with a mod file) would be greatly appreciated.
Best regards,
Lara


#6

You cannot define Rss as a parameter and an expression. Delete it as a parameter. You only need betta as a parameter.


#7

Similar to Lara,

I defined first rss kss, iss as paramater in the parameter block and I deleted them from parameter block and deleted from parameter names and wrote in model block. But I still got the same answer with Lara.

k_over_ghss has wrong type, you cannot use it within as left-hand side of a pound (’#’) expression.

Could you help me?


#8

[quote=“Niklas”]Dear jpfeifer,

as always thank you very much! This helps!

One question concerning the speed of computation (What do you mean exactly by “overhead of the steady state file” in this context?):
If I have a large DSGE model, NOT log-linearized, where the steady state is currently calculated in the parameters block, what is faster when it comes to estimation: Computing the steady state using the pound operator (although this could get very messy) or using an external steady state file?

All the best,
Niklas[/quote]

As far as I understand, if the model is not linearized then using the pound operator and subsequently setting up the initval; block is a mess because one has to express the ss-values in the initval; block as functions of parameters (if one wants to use ss-values in the initval; block) and therefore one gets pretty long expressions. Thus, if model is not linearized, there is a clear advantage of using the ss-file.


#9

Regarding the speed, here is an example:

Schmitt-Grohe&Uribe (2003) non-linearized model with 12 vars; 9 estimated params using one observed variable; details here:

estimation(order=1, datafile=grohe_uribe03data, mh_replic=2000, mh_nblocks=2, mh_jscale=0.02, mode_compute=6, forecast=40) y_obs;  

The ss-file takes 10min, while the pound-operator shouts about ‘SOLVE: maxit has been reached’ and takes 32min.

The posteriors and thus estimated ss-vals are not identical either: while the ss-file stays close to the (rather tightly specified) priors, the pound operator has changed some of the distributions.

The files attached; the data here:

[code]y_obs =

0.0093
0.0098
0.0059
0.0077
0.0062
0.0215
0.0199
0.0230
0.0347
0.0130
0.0339
0.0053
0.0187
0.0076

-0.0311
0.0306
-0.0067
0.0273
0.0067
0.0129
0.0092
0.0309
0.0024
0.0236
0.0342
-0.0091
0.0303
0.0073
0.0267
0.0239
0.0226
0.0161
0.0133
0.0216
0.0134
0.0289
0.0229
0.0055
0.0186
0.0278
0.0244
0.0423
0.0313
0.0203
0.0262
0.0188
0.0311
0.0293
0.0282
0.0024
0.0134
-0.0105
-0.0056
-0.0605
-0.0200
-0.1061
-0.0110
-0.0682
0.0102
0.0068
0.0041
0.0066
0.0108
0.0149
0.0198
0.0128
0.0095
0.0126
0.0138
0.0165
0.0135[/code]
grohe_uribe03est_pound.mod (4.13 KB)
grohe_uribe03est_steadystate.m (2.52 KB)
grohe_uribe03est.mod (3.09 KB)


#10

Note that the initval-block is executed sequentially. Thus, you could use

inv=deltaa*k;
if k has been solved before. This simplifies the mess a bit.

Moreover, your initial values only work for the baseline calibration. If you set alpha=0.9 the residuals are not 0. Thus, Dynare always numerically solves the SS, which explains the slowness.


#11

Indeed, not that messy for this model:

var  d c h y inv k a lambdaa  tb ca riskpremium r 
       y_obs;  

varexo e;                                    
                                             
parameters  gammaa, omegaa, rhoo, sigmae, deltaa, psii, alphaa, phii, r_w, d_bar;

		alphaa  = 0.32;
		rhoo    = 0.42;
		phii    = 0.028;
		r_w    = 0.04;		
 gammaa  = 2;
		omegaa  = 1.455;
		psii    = 0.000742;
		deltaa  = 0.1;
		sigmae = 0.0129;
		d_bar  = 0.7442;

		

model;
    #betaa   = 1/(1+r_w);
    #h_ss   = ((1-alphaa)*(alphaa/(r_w+deltaa))^(alphaa/(1-alphaa)))^(1/(omegaa-1)); 
	#k_ss   = h_ss/(((r_w+deltaa)/alphaa)^(1/(1-alphaa)));
	#inv_ss   = deltaa*k_ss;                                                     
	#y_ss   = (k_ss^alphaa)*(h_ss^(1-alphaa));                                   
	#d_ss   = d_bar;                                                        
	#c_ss   = y_ss-inv_ss-r_w*d_ss;
	#tb_ss  = y_ss-c_ss-inv_ss;
    d = (1+exp(r(-1)))*d(-1)- exp(y)+exp(c)+exp(inv)+(phii/2)*(exp(k)-exp(k(-1)))^2;
    exp(y) = exp(a)*(exp(k(-1))^alphaa)*(exp(h)^(1-alphaa));
    exp(k) = exp(inv)+(1-deltaa)*exp(k(-1)); 
    exp(lambdaa)= betaa*(1+exp(r))*exp(lambdaa(+1)); 
    (exp(c)-((exp(h)^omegaa)/omegaa))^(-gammaa)   = exp(lambdaa);  
    ((exp(c)-((exp(h)^omegaa)/omegaa))^(-gammaa))*(exp(h)^omegaa)  = exp(lambdaa)*(1-alphaa)*exp(y); 
    exp(lambdaa)*(1+phii*(exp(k)-exp(k(-1)))) = betaa*exp(lambdaa(+1))*(alphaa*exp(y(+1))/exp(k)+1-deltaa+phii*(exp(inv(+1))-deltaa*exp(k))); 
    a = rhoo*a(-1)+e; 
    tb = 1-((exp(c)+exp(inv))/exp(y));
    ca = (1/exp(y))*(d-d(-1));                                   
    riskpremium = psii*(exp(d-d_bar)-1);
    exp(r) = r_w+riskpremium;

    y_obs = 0.012+ y-y(-1); //yoy ss growth 4.8%
end;


// dynare solves ss numerically at every iter which explains the slowness
initval;
    r     = log((1-1/(1+r_w))/(1/(1+r_w)));
    d     = d_bar;
    h     = log(((1-alphaa)*(alphaa/(r_w+deltaa))^(alphaa/(1-alphaa)))^(1/(omegaa-1)));
    k     = log(exp(h)/(((r_w+deltaa)/alphaa)^(1/(1-alphaa))));
    inv=log(deltaa)+k;
    y=alphaa*k+(1-alphaa)*h;
    c=log(exp(y)-exp(inv)-r_w*d);
    tb    = 1-((exp(c)+exp(inv))/exp(y));
    lambdaa= log((exp(c)-((exp(h)^omegaa)/omegaa))^(-gammaa));
    y_obs=0.012;          //yoy ss growth 4.8%
end;


shocks;
    var e; stderr sigmae;
end;

resid(1);

steady; 

check;


estimated_params;
alphaa, beta_pdf,  0.3, .005;
rhoo, beta_pdf,  0.42, .002;
phii, beta_pdf, 0.028, .001;
r_w, beta_pdf,   0.02, .005;		
gammaa, normal_pdf,  2, .01;
omegaa, normal_pdf, 1.455, .01;
psii, beta_pdf, 0.000742, .0000001;
deltaa, beta_pdf, 0.1, .001;
d_bar, beta_pdf,  0.7442, .001;


//stderr sigmae, inv_gamma_pdf, 0.0129, inf;
end;

varobs y_obs;

estimation(order=1, datafile=grohe_uribe03data, mh_replic=2000, mh_nblocks=2, mh_jscale=0.4, 
 mode_compute=6, forecast=40) y_obs;

#12

Hello,

I have one question which is related to the topic.
If in the steady-state block there is the declaration for R, i.e.

R = Rss;

Then when Rss is updated, also the steady state of R is updated right?
But then, why the resulting steady state still includes the initial steady-state value for R?

Thanks


#13

You need to be more precise. What is the particular setup you have in mind?