Page 1 of 1

Matlab-style If loop in a declared Model

Posted: Fri May 05, 2017 2:42 pm
by kinglim1515
Hi,

I have a model with endogenous switching condition that I am having trouble to program.

In short, say I have these in EViews:


'declare model
chi_m = 0.1
smpl 1 200
model snorms

'Equation 1:
snorms.append sigma = .......................

'Equation 2:
snorms.append varkappa = ....................

'Equation 3:
snorms.append chi = (chi(-1)^(0.2))*((chi_m*varkappa)^(1-0.2))

' Solve the model:
snorms.scenario(n,a = _1)
solve(o=n, c=1e-6, m=5000) snorms

While this is straightforward, but if I have a switching condition for chi where if an observation for varkappa is below a threshold, i used a separate condition for chi, else use back the more general equation:

If varkappa < 0.31 then
snorms.append chi = 0.2
else
snorms.append chi = (chi(-1)^(0.2))*((chi_m*varkappa)^(1-0.2))
endif

Directly inserting this into the defined model does not work. Does anyone have any suggestion to try with this? Thank you.

Regards,
King

Re: Matlab-style If loop in a declared Model

Posted: Fri May 05, 2017 3:07 pm
by EViews Gareth
@recode