```
// 2-period OLG, closed economy//
var y k w s r cy co D Check Check2 e1 e2;
predetermined_variables k;
// Exogenous variables are TFP, tax rate and government consumption
varexo A teta b;
parameters T beta m alpha delta sigma1 rho1 sigma2 rho2;
T = 40;
beta = 0.98;// discount rate
m = 0.9;// myopia factor
delta = 0;// depreciation
alpha = 0.412;// labor share of income
sigma1 = 0.138;
rho1 = 0.95;
sigma2 = (0.007)/(1-alpha);
rho2 = 0.95;
//model(differentiate_forward_vars=(D));
y = A*k^(1-alpha);
r + delta = (1-alpha)*(A*k^(-alpha));
w = alpha*y;
1/cy = beta*(1-m)*((1+r(+1))/(co(+1)));
cy = w*(1-teta) - s;
co = (1+r)*s(-1)+b;//R = 1+r
k(+1)= s + k*(1-delta) - D;
D(+1) = b - w*teta + D*(1+r);
Check = y - (r+delta)*k - w;
Check2 = y - cy - co - s - (1-delta)*k(-1)*(r) - w*teta + D*(1+r);
///model(differentiate_forward_vars=(D));
yss = A*kss^(1-alpha);
rss + delta = (1-alpha)*(A*kss^(-alpha));
wss = alpha*yss;
1/cyss = beta*(1-m)*((1+r(+1))/(coss(+1)));
cyss = wss*(1-teta) - sss;
coss = (1+r)*s(-1)+b;//R = 1+r
kss = 1;
D(+1) = b - wss*teta + Dss*(1+r);
// Shock to equity returns
e1 = rho1 * e1(-1) + teta;
// Shock to productivity
e2 = rho2 * e2(-1) + b;
end;
//************** Declare initial values **************//
initval;
k = kss;
cy = cyss;
co = coss;
r = rss;
w = wss;
y = yss;
s = sss;
D = Dss;
Check = 0;
Check2 = 0;
end;
//************** Debugging **************//
resid(1);
check;
model_diagnostics;
//************** shocks **************//
shocks;
var teta = sigma1^2;
var b = sigma2^2;
end;
stoch_simul(periods=3000);
```

You did not say anything about your error type in Dynare.

Altough I think that you did not set \star for some variables in your equations.

error: y is not a parameter

I think that you did not set * for some of your equations in the model.

For example in the first equation or production function:

y=A*k^(1-alpha) ;

You commented out the `model;`

statement.

I don’t think this is true because the model provided steady state values with the same appearance

bbb.mod (1.1 KB)

In your first post * sign was not ready for many equations of the model.

It seems that you reformed the model.

When you post text without putting it into ```, then the * sign is the sign for italics. I had reformatted the original post.

Again, you commented out the model-statement:

```
//model(differentiate_forward_vars=(D));
```

// is the command for comments.

```
// 2-period OLG, closed economy//
var y k w s r cY cO D Check Check2;
predetermined_variables k;
// Exogenous variables are TFP, tax rate and government consumption
varexo A teta b;
parameters T beta m n alpha delta ;
T=40;
beta = 0.98;// discount rate
m = 0.9;// myopia factor
alpha = 0.42;// capital share of production
n = 0.012;
phi= 0.1;
model(differentiate_forward_vars=(D));
y = A*k^(alpha);
r = (alpha)*(A*k^(alpha-1))-1;
w = (1-alpha)*y;
1/cY = beta*(1-m)*((1+r(+1))/(cO(+1)));
cY = w*(1-teta) - s;
cO = (1+r)*s(-1)+b;//R = 1+r
k(+1)*(1+n)= s -D;
D(+1) = b - w*(1+n)*teta + D*(1+r);
Check = cO - (1+n)*beta*cY;
Check2 = y - (cY + cO)/1+n - (1+n)*k;
end;
initval;
y=1.04304;
k=0.0239528;
w = 0.604962;
s=0.0316528;
r= 17.2891;
cY=0.367622;
cO= 0.6589;
D= 0.00741249
shocks;
var teta= 0.009^2;
var b=0.009^2;
var teta, b = phi*0.009*0.009;
end;
stoch_simul(periods=3000);
```

what is the cause of the following error?

ERROR: line 41, cols 1-3: syntax error, unexpected VAR

There is no `end;`

to your `initval`

-block.

OK; But despite **end** at the block of initval , it still gives the same error

ERROR: bbb.mod: line 44, cols 1-3: syntax error, unexpected VAR, expecting ‘;’ or ‘(’

Always provide the full version of the latest version of your mod-file.

bbb.mod (963 Bytes)

Starting Dynare (version 5.4).

Calling Dynare with arguments: none

Starting preprocessing of the model file …

ERROR: bbb.mod: line 44, cols 1-3: syntax error, unexpected VAR, expecting ‘;’ or ‘(’

Error using dynare (line 266)

Dynare: preprocessing failed

There were various issues like a missing semicolon. I fixed a few things. Now the problem is the steady state:

bbb.mod (975 Bytes)

Now do you think the initial values should be changed? Because I had obtained the initial values that I put in the model from the following file:

olgg.mod (1.3 KB)

Those initial values are conditional on the value of the exogenous variables. In stochastic simulations, their value will be set to 0. You need to adjust the initial values and/or the model equations accordingly.

dynare ddd

Starting Dynare (version 5.4).

Calling Dynare with arguments: none

Starting preprocessing of the model file …

Substitution of forward vars: added 1 auxiliary variables and equations.

Found 11 equation(s).

Evaluating expressions…done

Computing static model derivatives (order 1).

Computing dynamic model derivatives (order 2).

Processing outputs …

done

Preprocessing completed.

Error using ddd.driver

Error: File: driver.m Line: 213 Column: 8

Incorrect use of ‘=’ operator. To assign a value to a variable, use ‘=’. To compare values for equality,

use ‘==’.

Error in dynare (line 278)

evalin(‘base’,[fname ‘.driver’]);

ddd.mod (1.2 KB)

You can only use direct assignments outside of the `model`

block. For example,

```
1/cYss = beta*(1-m)*((1+r(+1))/(cOss(+1)));
```

is not allowed.

hi;What do you think about my modeling?Especially equation 5(Population growth equation)

bbb.mod (1005 Bytes)