Hi all,

I have a very simple deterministic system of equations with 4 equations, 4 endogenous variables and 1 exogenous.

My problem is that I get the following error message:

"Attempted to access M_.params(5); index out of bounds because numel(M_.params)=4.

Error in ==> my_model_steadystate at 5

ys_(1)=(M_.params(5)/(1-M_.params(5))*M_.params(1)*(1-M_.params(4)))^(1/(1-M_.params(1)));"

I post the short code here:

// Endogenous variables: capital, quality, consumption, abatement

var k Q c m;

// Exogenous deterministic variable: population level

varexo pop;

// Parameters declaration and calibration. IMPORTANT RESTRICTION: eta<pop*(1-beta*(1+eta))/beta

parameters alpha eta mu beta;

alpha=0.3;

// pop=1;

eta=0.04;

mu=0.8;

beta=0.9;

//change_type (varexo) pop

// Equilibrium conditions

model;

(pop/c)=beta*((pop/c(+1))*(1+alpha*k^(alpha-1))-pop*mu*alpha*k^(alpha-1)/c(+1));
(1/c)=beta*(1/Q+(1+eta)/c(+1));

k=k(-1)^(alpha)+k(-1)-c-m;

Q=(1+eta)

*Q(-1)+pop*(m-mu*k(-1)^(alpha));

end;

// initial values of our choice. When simulating, what the program does is taking “c_0” and “m_0” as mere GUESSES and using them along with “k_0” and “Q_0” to actually find the “true”

// c_0 and m_0.

initval;

pop=1;

k=((beta/(1-beta))*(alpha*(1-mu)))^(1/(1-alpha));

c=(pop*(1-mu)*k^(alpha))*(1-beta*(1+eta))/(pop*(1-beta*(1+eta))-beta*eta);
Q=(beta*pop*(mu-1)

*k^(alpha))/(beta*eta-pop*(1-beta*(1+eta)));

m=k^(alpha)-c;

end;

/*

- With the following block we tell Dynare that the one below is the exact steady state (this is used when we know it and have derived it analytically):
- steady_state_model;
- k=((beta/(1-beta))
*(alpha*(1-mu)))^(1/(1-alpha)); - c=(pop*(1-mu)
*k^(alpha))*(1-beta*(1+eta))/(pop*(1-beta*(1+eta))-beta*eta); - Q=(beta
*pop*(mu-1)*k^(alpha))/(beta*eta-pop*(1-beta*(1+eta))); - m=k^(alpha)-c;
- end;

*/

// Check that this is indeed the steady state

steady;

// Check the Blanchard-Kahn conditions

check;

// convergence from “initval” to steady state (analytically solved)

// Declare a TEMPORARY positive population shock (increased by 0.1) in period 1 lasting through period 5

shocks;

var pop;

periods 1;

values 1.1;

end;

// Declare a PERMANENT positive population shock (increased by 0.1) so that the ss changes (transition from old ss with pop=1 to new ss with pop=1.1)

/*

- endval;
- pop=1.1;
- k=((beta/(1-beta))
*(alpha*(1-mu)))^(1/(1-alpha)); - c=(pop*(1-mu)
*k^(alpha))*(1-beta*(1+eta))/(pop*(1-beta*(1+eta))-beta*eta); - Q=(beta
*pop*(mu-1)*k^(alpha))/(beta*eta-pop*(1-beta*(1+eta))); - m=k^(alpha)-c;
- end;

*/

// Deterministic simulation of the model for 25 periods

simul(periods=25);

// Display the path of consumption, capital, quality and abatement

rplot c;

rplot k;

rplot Q;

rplot m;

I don’t understand what the problem is because I’m trying to do EXACTLY the same exercise as in example model “ramst” (my model and ramst are very similar since they are both simple neoclassical deterministic models) that comes with the dynare package when downloading. I’m trying to analyze the effect of a temporary shock on the exogenous variable “population” just as in the “ramst” model a temporary technology shock is analyzed.

THANK YOU very much for your help. Really appreciate!