# Variance in Technology Shocks

Hello,

I’m new to Dynare, and I would really appreciate it if you guys could help me out. I’m running a simple RBC model, and I want to change the variance of the technology shocks. (I call the variance log_s.) I want to have high(=3) and low(=1) variance at different time periods, with a .625 chance that the current time period’s variance is the same as the previous time period’s (so a .375 chance it switches). I do this using eta2, drawn from a standard normal distribution, with .319 as the z-score cutoff - since there is a .625 chance that a standard normal variable will fall below .319. Since I know that Dynare accepts logical statements and interprets them as 1 if true and 0 if false, I thought the following would work:

log_s = (eta2 < z)(log_s(-1)) + (eta2 > z)(log_s(-1) == low)(high) + (eta2 > z)(log_s(-1) == high)*(low);

where log_A = rho*log_A(-1) + (log_s)*eta;

However, when I run my code, log_s does not change. What am I doing wrong? I have attached my complete code below. Thanks in advance for your help!

# ================================ Code

var log_c log_k log_h log_A log_w r log_i log_y log_s;
varexo eta eta2;

parameters beta alpha gamma delta rho s epsilon z high low;
beta=0.985;
alpha=1/3;
gamma=1;
delta=0.025;
rho = 0.9;
s=0.0107;
epsilon = 1;
z = 0.319;
high = 3;
low = 1;

model;

// HOUSEHOLDS:
// Euler equation:
1/exp(log_c) = beta*(1+r(+1)-delta)*( 1/exp(log_c(+1)) );

``````// Intra-temporal condition (FOC with respect to h):
( 1/exp(log_c) )*exp(log_w) = gamma*exp(log_h)^(1/epsilon);

// Budget constraint of households
exp(log_k) = (1+r-delta)*exp(log_k(-1)) + exp(log_w)*exp(log_h) - exp(log_c);

// Capital accumulation:
exp(log_k) = (1-delta)*exp(log_k(-1)) + exp(log_i);
``````

// FIRMS:
// FOC labor:
exp(log_w) = (1-alpha)exp(log_A)( exp(log_k(-1))/exp(log_h) )^alpha;

``````// FOC capital:
r = alpha*exp(log_A)*( exp(log_h)/exp(log_k(-1)) )^(1-alpha);

// Output
exp(log_y) = exp(log_A)*exp(log_k(-1))^alpha*exp(log_h)^(1-alpha);
``````

// EXOGENOUS PROCESS FOR TECHNOLOGY
log_s = (eta2 < z)(log_s(-1)) + (eta2 > z)(log_s(-1) == low)(high) + (eta2 > z)(log_s(-1) == high)*(low);

`````` log_A = rho*log_A(-1) + (log_s)*eta
``````

end;

initval;
log_k= 3.08518;
log_c= 0.738489;
log_h= -0.0866715;
log_A=0;
log_s = 1;
log_w=log( (1-alpha)exp(log_A)( exp(log_k)/exp(log_h) )^alpha );
r=alphaexp(log_A)( exp(log_h)/exp(log_k) )^(1-alpha);

``````log_i= -0.603697;
log_y= 0.970611;
``````

end;

shocks;
var eta2;
stderr 1;
var eta;
stderr 1;
end;