Setting minimum while solving multiple equations.

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

Moderators: EViews Gareth, EViews Moderator

smith007
Posts: 3
Joined: Thu Apr 12, 2012 4:07 pm

Setting minimum while solving multiple equations.

Postby smith007 » Thu Apr 12, 2012 4:15 pm

Hello,
This is my first time programming Eviews. I am using version 7. I searched through the forum but could not find this solution.

I have a system of 15 equations that I have added with the .append command. What I would like to do is somehow set a minimum value for an endogenous variable while the system is solving. Example.

model1.append a = a_0(-1) - b*c

What I would like to happend is that if the value of a drops below zero then it would just return zero until it once again starts to get positive values. Is there any way to do this?

Thank you.

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

Setting minimum while solving multiple equations.

Postby EViews Gareth » Thu Apr 12, 2012 6:33 pm

Your notation/description is a little confusing.

The text makes me believe you're using a system object. The formula your wrote makes me believe you're using a model object.

Perhaps you could expand a bit?
Follow us on Twitter @IHSEViews

smith007
Posts: 3
Joined: Thu Apr 12, 2012 4:07 pm

Re: Setting minimum while solving multiple equations.

Postby smith007 » Fri Apr 13, 2012 10:43 am

I am not 100 familiar with the terminology but I think I am using a model object. I created a new model using model command

like this:

model model1
model1.append a = a_0(-1) - b*c

I use this method to enter a number of equations and i also give initial values to my parameters . Normally it would all solve to a steady state. I create a new scenario that would apply a shock to the system something like

model.scenario baseline
smpl 1950 @last

smpl 1960 @last
some paramater = new value
smpl @all

model1.solve

I then have it draw all the shock responses in graphs. What I would like to do is to somehow set a minimum value for one of the varaiables that is responding to the shock. In particular I have an endogenous interest rate being determined by the system and I would like it to have a minimum value of 0.

EViews Chris
EViews Developer
Posts: 161
Joined: Wed Sep 17, 2008 10:39 am

Re: Setting minimum while solving multiple equations.

Postby EViews Chris » Fri Apr 13, 2012 2:13 pm

One way to do this is to use equations whose functional form makes it impossible to end up with a value that make no economic sense (although I think T-bill rates did briefly go negative in late 2008...).

So instead of a linear function like:

y = c(1)*x + z

You might use a log-linear function like:

log(y) = c(1)*log(x) + z

The latter equation generates positive values for y for all values of x and z.

You could also try repalcing the single equation with two equations like this:

y_raw = c(1)*x + z
y = @recode(y_raw>=0, y_raw, 0)

so that y is forced to be non-negative.

This may cause some problems with finding a solution though because the EViews model solution algorithms assume that the model has equations with continuous derivatives and the @recode function makes the derivatives discontinuous. You can certainly give it a try though.

smith007
Posts: 3
Joined: Thu Apr 12, 2012 4:07 pm

Re: Setting minimum while solving multiple equations.

Postby smith007 » Fri Apr 13, 2012 5:19 pm

I will try to express things in change rates.

Thank you both for your quick replies.

jlbrillet
Posts: 49
Joined: Mon Feb 16, 2009 6:03 am

Re: Setting minimum while solving multiple equations.

Postby jlbrillet » Sat May 19, 2012 12:46 am

You might also use :

model1.append a1 = a_0(-1) - b*c
model1.append a = a1*(a1>=0)

Jean Louis Brillet.

Karl1
Posts: 27
Joined: Tue Aug 27, 2013 1:10 am

Re: Setting minimum while solving multiple equations.

Postby Karl1 » Tue Oct 29, 2013 6:24 am

I tried the latest suggestion, but it does not work so well.

The new variable is not ecsactly equall to zero when the original variable is negative. When the original variabel has the value -0.9, the new variable has the value 1.0. In my model this is interst rates, so the difference is large. In addition, when the original variabel turns positive again after a period with negative values, there is a big difference between the new and original variabel. They should have been equall. Old variable value is 0.4 and the new is 1.6.

Does anybody know how to fix this, so that the new variarble equalls the old exactly when the old is positive, and equalls zero exactly when the old is negative?

Karl1
Posts: 27
Joined: Tue Aug 27, 2013 1:10 am

Re: Setting minimum while solving multiple equations.

Postby Karl1 » Tue Nov 19, 2013 6:23 am

Guess nobody knows how to fix this.
Does anybody know why this happends? Why isn't the values identical when the original value is positive, and why is the new value not equall to zero when the original value is negative?

Karl1
Posts: 27
Joined: Tue Aug 27, 2013 1:10 am

Re: Setting minimum while solving multiple equations.

Postby Karl1 » Mon Jan 20, 2014 10:36 pm

Answer to my own question:
It works when deterministic simulations is used. Did not work with stochastic simulations.


Return to “Models”

Who is online

Users browsing this forum: No registered users and 11 guests