Growth Model Using Detrending Commands

Hi all!

I want to implement a standard deterministic neoclassical growth model in Dynare. However, I would like to left the detrending process to Dynare, using the commands: trend_var, growth_factor, and deflator. As usual, this kind of model has two exogenous sources of growth: population growth and technological growth. In this case, the variables should be detrended by these two sources of growth. I couldn’t figure it out how to apply the above commands to detrend each variable using both sources of growth.

The example below by Johannes Pfeifer detrends each variable by only one source of growth.

github.com/DynareTeam/dynare/bl … ionary.mod

I hope to hearing from you guys!

Best to all!

Can anybody confirm if the statements below are correct in this case?

var gN gA;
trend_var(growth_factor=gN) N;
trend_var(growth_factor=gA) A;
var(deflator=N*A) k c y;

Thanks!

The following link solved the above question:

dynare.org/DynareWiki/RemovingTrends

However, in the link, the growth factors are endogenous. In my model, the growth factors are exogenous, taken from data. What is the solution for my case? I’m having trouble solving it.

Best to all!

What do you mean with: growth factors are exogenous, taken from data? Are you trying to do estimation? Or why are the data relevant for your modeling? Following the approach at the link, you could within the model simply define

g=0.02;

if g is constant at 2 percent.

Thanks jpfeifer!

In fact, I want to compute the the transition from a point in time (e.g. 1970) to the future (e.g. 2015 or SS) in order to evaluate the performance of the model in replicating the data. Hence, from 1970 to 2015, for example, I want to take as given the TFP and the population data, and check if the endogenous variables become close to data. After 2015, I will consider steady state (constant) growth rates for both variables. I don’t know to do this in Dynare.

Attached is a sketch of my code. I know it is not complete, but just for you to see how I am using the detrending commands.

Best!
code.mod (2.13 KB)

You need to think more about the structure of the exercise you want to conduct. Is it perfect foresight or are innovations to TFP and population growth stochastic and agents react to these surprises? If the latter, the setup is simular to the one conducted via the simult_-function in github.com/JohannesPfeifer/DSGE_mod/tree/master/RBC_news_shock_model, where you could feed in a shock sequence for the bivariate shock process

Hi jpfeifer!

As mentioned in the first post, I am using a standard deterministic neoclassical growth model, very simple. Hence, it is perfect foresight, no shocks. Below is the Dynare code for the detrended model (I detrended by hand).

So, two things are still not clear:

  1. Writing a non-detrended model and use the Dynare detrend commands to solve the model.

  2. Considering the historical values of the exogenous variables (TFP and pop growth rates) in the transition computation. I want to use these historical values until a certain date (e.g. 2015) and after that I consider constant values for these growth rates.

Thanks!
code2.mod (1.88 KB)

If you are using perfect forsight, there is no reason to detrend the model. Essentially, you just need to provide the exogenous state variable to the solver. That is done via initval, endval, and shocks. Alternatively, you can use an initval file or just manipulate the oo_.exo_var matrix before calling the solver.

Hi jpfeifer,

But if I don’t detrend my model, there will be no steady state, right? I think I do need to detrend the model.

A steady state is always conditional on the values of the exogenous variables. In a growth model, the BGP is a sequence of steady states. For deterministic simulations you do not necessarily need to transform this sequence of steady steady states into one fixed steady state, because you can easily compute the terminal condition.

Dear community,
I’m sorry to be asking so many things these days… I’m trying to introduce population growth and our OLG model. I looked at the fs2000_nonstationary.mod in the example files, but something is wrong in my code. I upload a version without any growth source that works fine and the file that tries to add growth in population:

AspirationsHabitsUBI_dif_pop.mod (4.2 KB)
AspirationsHabitsUBI_dif_shock.log (4.6 KB)
The error message I get is:

Residuals of the static equations:

Equation number 1 : -0.023319 : cy
Equation number 2 : -3.0409 : 2
Equation number 3 : 0.085374 : 3
Equation number 4 : -3.2009 : 4
Equation number 5 : -Inf : w
Equation number 6 : 0 : 6
Equation number 7 : 0 : 7
Equation number 8 : NaN : 8
Equation number 9 : NaN : g
Equation number 10 : NaN : 10
Equation number 11 : -Inf : y
Equation number 12 : -Inf : U
Equation number 13 : -2.7183 : gn

Randomize initial guess…

Residuals of the static equations:

Equation number 1 : NaN : cy
Equation number 2 : NaN : 2
Equation number 3 : NaN : 3
Equation number 4 : NaN : 4
Equation number 5 : NaN : w
Equation number 6 : NaN : 6
Equation number 7 : NaN : 7
Equation number 8 : NaN : 8
Equation number 9 : NaN : g
Equation number 10 : NaN : 10
Equation number 11 : NaN : y
Equation number 12 : NaN : U
Equation number 13 : NaN : gn

Error using print_info
The steady state has NaNs or Inf.

Error in steady (line 102)
print_info(info,options_.noprint, options_);

Error in AspirationsHabitsUBI_dif_pop.driver (line 268)
steady;

Error in dynare (line 281)
evalin(‘base’,[fname ‘.driver’]);

May the problem be in the detrending instructions I gave or in the initial values?
Thank you.

  1. You need to initialize g_n as well.
  2. Your setup looks wrong. The labor FOC is
    w = (1-alp)*z*(z*L/k(-1))^(-alp);

If both L and k on the right have the trend n, then there cannot be a trend in w.

AspirationsHabitsUBI_dif_pop.mod (3.8 KB)
Thanks. I see what you say… Indeed, before I had k and L to be detrended, but not w. However, I got the following error (see the attached code):

dynare AspirationsHabitsUBI_dif_pop
Starting Dynare (version 5.5).
Calling Dynare with arguments: none
Starting preprocessing of the model file …
Found 13 equation(s).
Evaluating expressions…done
ERROR: trends not compatible with balanced growth path; the second-order cross partial of equation 1 (line 48) w.r.t. trend variable n and endogenous variable cy is not null (abs. value = 93.9202). If you are confident that your trends are correctly specified, you can raise the value of option ‘balanced_growth_test_tol’ in the ‘model’ block.

Error using dynare
Dynare: preprocessing failed

What may be the source of this error? Thank you so much.

  1. Again, you did not initialize gn=exp(1) in initval.
  2. Take
    (alp*(k(-1)/(z*L))^(alp-1)) = 1 + r;
    
    k is the only trending variable here. That cannot be correct.

Thanks for your patience. I realized that, given how I define/write the model equations, the only trending variable is k… I corrected this and, now, I get the following error message:

Error using dynare
Dynare: preprocessing failed

dynare AspirationsHabitsUBI_dif_pop
Starting Dynare (version 5.5).
Calling Dynare with arguments: none
Starting preprocessing of the model file …
Found 13 equation(s).
Evaluating expressions…done
ERROR: trends not compatible with balanced growth path; the second-order cross partial of equation 4 (line 60) w.r.t. trend variable n and endogenous variable gn is not null (abs. value = 1.94724). If you are confident that your trends are correctly specified, you can raise the value of option ‘balanced_growth_test_tol’ in the ‘model’ block.

Error using dynare
Dynare: preprocessing failed

… what else I am doing incorrectly? Here is the mod-file:
AspirationsHabitsUBI_dif_pop.mod (4.2 KB)

Again, that cannot be correct:

(alp*(k(-1)/(z*L))^(alp-1)) = 1 + r;

cannot have k as the only trending variable.

AspirationsHabitsUBI_dif_pop.mod (4.2 KB)
Many thanks, again. Here is the working code, just in case anybody else has the same difficulties…
I have a question regarding the interpretation of the output.
I obtain IR plots for the permanent shock eg (and they are different from those of the version without population growth). I understand these show the response of the economy to the shock, accounting for per-period population growth.
I also obtain plots for the shock e_n (population growth). However, this is not a one-time shock. What are the IR showing me? Is it the isolated effect of population growth on the economy from period (0) in which this growth starts?
Thank you for your help.

The IRFs are to a one standard deviation innovation to the exogenous shock. In your case, that is a one-time increase e_n. You can see that in the IRF for g_n. But keep in mind that the IRFs are for the detrended variables, which are rendered stationary. That’s why you don’t see a level effect.