Efficient quantity

Dear all
I am new user dynare, and I want to estimate the efficient amount of decision variable, therefore how to write the appropriate code in dynare

You need to provide a lot more detail. What exactly are you trying to do?

Dear professor
thanks a lot for your reply
I run a DSGE model for Iran and I want to estimate potential output by using estimated parameters, the potential output is the level of output in an environment without nominal rigidities in goods and labor markets and
without shocks to price and wage markups.
in fact how to write the code in dynare
best regard

You can do that with a lot of models. So first you have to choose one model, try to code it in Dynare, and then we can help you when you will have precise issues with your model. You can do that with a Smets and Wouters model for example, but I don’t know which feature you need in your model.


tanke you so much
dear stephan, i estimated the parameters but i do not know write a code in dynare for estimating the variables such consumption

But if you have estimated your model already, all you need to do is run the Kalman smoother on the model.

tanke you so much professor jpfeifer
how do it in dynare? in fact how simulated potential output after estimated parameters?

As said by Johannes, if you defined the output gap in your model, you just need to add the smoother option in the estimation command and the name of the output gap variable after the estimation command. Something like:

estimation(..., smoother, ...) OutputGap ;

See the estimation section in the reference manual.


1 Like

Dear stepan
tanks a lot for your reply
one of the my observed variables are “y”, can I predict “y” by using DSGE? and do predicted of “y” is different from observed “y”?

Sure, it is possible to forecast with a DSGE model, and the forecast will be different from the actual realization of the variable.

  • The forecast option of the estimation triggers the computation of the posterior predictive density of the observed variables after the end of the sample used in estimation.

  • The filtered_vars or filter_step_ahead options of the estimation command trigger the computation of the posterior distribution of the one or k step ahead filtered variables, i.e. the expectation of the variables in t+k conditional on the information available at time t.

The first approach provide out of sample forecast, while the second one delivers in sample forecasts. You will find more details in the reference manual.


Dear Stepan tanks a lot for your contribution
I want to index the horizon axis to year over 1960-2010, and also my graphic at starting point indexed to a number such 100, How do this in dynare?

Please see Placing dates on the horizontal axis of shock decomposition

An example. If you computed the filtered variables (with filtered_vars option in the estimation command), then you can define a dseries object as follows:

>> data = dseries(oo_.Filtered_Variables_1_step_ahead.Mean.y, '1980Q1', 'y');

where the string '1980Q1' is the initial period, and the last argument the name of the variable. Then you just have to use the overloaded plot function:


which will produce something like: dseries-plot.pdf (4.6 KB)


tank a lot for all contribution
Dear Stepan, I want to decompose consumption and production by shocks, how I can to do it?

There is a command called shock_decomposition for that. See the reference manual here.


Dear Stepan
When I use the shock_decomposition after estimation, I see negative contribution of various shocks for endogenous variable, However the contribution of various shock must be positive, therefore my question is why the contribution of shocks are negative? and what is the problem?
best regard

Hi, you are doing a decomposition of the levels of time series (not of the volatility of the time series). A shock can contribute positively or negatively to the levels. Consider a supply shock (for instance a TFP shock). An increase in productivity will augment the production but lower inflation. There is no theoretical reason to have only positive contributions. Hence, a priori, there is no problem with your results if you are able to interpret them.


Dear Stepan , tanks a lot for your time
when I use variance decomposition command (moments_varendo) in estimation, dynare reports the NaN for effects of shocks , what is the problem with my model?

Please provide the files necessary to replicate the issue

estimation(datafile=dataset,xls_sheet=Sheet1,xls_range = A1:G109,mh_replic=12000, mh_nblocks=8 ,mh_drop=0.3,smoother, mh_jscale=0.4, moments_varendo, mode_compute=6, mode_check, lik_init=2) y c i g o;