CASSKOOPMANS.RPF is an example of a simple dynamic linear model (Cass-Koopmans with production linear in capital) solved using DSGE. This has no expectational terms or shocks, so the only reason for using DSGE is to handle the unstable root (without solving it "backwards", capital explodes and virtually all the output goes into maintaining an ever increasing capital stock). The model is set up with

frml(identity) f1 = u0-u1*c-lambda

frml(identity) f2 = f0*lambda-1.0/beta*lambda{1}

frml(identity) f3 = f0*k{1}-k-c{1}

*

group casskoopmans f1 f2 f3

C, K and LAMBDA are the three endogenous variables; U0, U1, BETA and F0 are parameters. Note that DSGE cannot solve out models symbolicallyâ€”the solutions are for a specific set of parameter values.

The following solves out the model for a backwards-looking solution with no unstable roots, where A is the state matrix in the transition and Z is the "constant" vector. Because of the order in which the variables are listed on the DSGE instruction, C is state 1 and K is state 2. This computes and displays the steady state.

disp "Consumption" @20 ss(1)

disp "Capital" @20 ss(2)

The program then does three "experiments" to see the dynamic behavior if the initial conditions are different from the steady-state. These are done with DLM using the X0 (which gives the initial state) and PRESAMPLE=X1 (which says that the initial state is actually for t=1, not t=0) options. This first one has consumption (state 1) set at 3, which is below the steady state of 5 (and capital is above its steady state). This creates the first graph below, where consumption jumps above the steady state straight off and then declines from there. The other experiments are done similarly.

dlm(x0=||3.0,17.0,u0-u1*3.0||,a=a,z=z,presample=x1) 1 20 xstates

set c 1 20 = xstates(t)(1)

set k 1 20 = xstates(t)(2)

Full Program

dec series c lambda k
dec real u0 u1 f0 beta
*
frml(identity) f1 = u0-u1*c-lambda
frml(identity) f2 = f0*lambda-1.0/beta*lambda{1}
frml(identity) f3 = f0*k{1}-k-c{1}
*
* Set parameters of the model
*
compute beta=.95,f0=1.3,u0=1.0,u1=0.2
*
group casskoopmans f1 f2 f3
*
* Because the model is linear, there's no need to compute an expansion
* point to get the state space representation; it's being done here to
* get the steady state so create the simulation scenarios.
*
disp "Consumption" @20 ss(1)
disp "Capital" @20 ss(2)
*
* Starting consumption below the steady state
*
dlm(x0=||3.0,17.0,u0-u1*3.0||,a=a,z=z,presample=x1) 1 20 xstates
set c 1 20 = xstates(t)(1)
set k 1 20 = xstates(t)(2)
graph(hlabel="Consumption")
# c
graph(hlabel="Capital")
# k
spgraph(done)
*
* Starting consumption above the steady state
*
dlm(x0=||6.0,17.0,u0-u1*6.0||,a=a,z=z,presample=x1) 1 20 xstates
set c 1 20 = xstates(t)(1)
set k 1 20 = xstates(t)(2)
graph(hlabel="Consumption")
# c
graph(hlabel="Capital")
# k
spgraph(done)
*
* Initial capital above the steady state
*
dlm(x0=||5.0,20.0,u0-u1*3.0||,a=a,z=z,presample=x1) 1 20 xstates
set c 1 20 = xstates(t)(1)
set k 1 20 = xstates(t)(2)
graph(hlabel="Consumption")
# c
graph(hlabel="Capital")
# k
spgraph(done)



Output