Matlab-style If loop in a declared Model

For technical support, tips and tricks, suggestions, or any other information regarding the EViews model object.

Moderators: EViews Gareth, EViews Moderator, EViews Chris

Posts: 1
Joined: Thu Feb 21, 2013 2:27 am

Matlab-style If loop in a declared Model

Postby kinglim1515 » Fri May 05, 2017 2:42 pm


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
snorms.append chi = (chi(-1)^(0.2))*((chi_m*varkappa)^(1-0.2))

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


EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 11598
Joined: Tue Sep 16, 2008 5:38 pm

Re: Matlab-style If loop in a declared Model

Postby EViews Gareth » Fri May 05, 2017 3:07 pm

Follow us on Twitter @IHSEViews

Return to “Models”

Who is online

Users browsing this forum: No registered users and 1 guest