Switching regression

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

rashid02
Posts: 6
Joined: Sat Oct 17, 2009 10:09 pm

Switching regression

Postby rashid02 » Sun Oct 18, 2009 5:32 pm

Hi,

I have obtained the following program for running switching regression from SAS site, I want to run it Eviews 6, can anybody help thanks. :lol:
The model requires determining two regimes using an unobserved variable which is function of other independent variables. SAS website has the following example:

As an example, you now can use this switching regression likelihood to develop a model of housing starts as a function of changes in mortgage interest rates. The data for this example is from the U.S. Census Bureau and covers the period from January 1973 to March 1999. The hypothesis is that there will be different coefficients on your model based on whether the interest rates are going up or down.
So the model for zi will be the following
zi = p * ( ratei - ratei-1 )
where ratei is the mortgage interest rate at time i and p is a scale parameter to be estimated.
The regression model will be the following

where startsi is the number of housing starts at month i and decjanfeb is a dummy variable indicating that the current month is one of December, January, or February.
this is the program code

proc model data=switch;
parms sig1=10 sig2=10 int1 b11 b13 int2 b21 b23 p;
bounds 0.0001 < sig1 sig2;

a = p*dif(rate); /* Upper bound of integral */ i do not understand this part throughout :cry:
d = probnorm(a); /* Normal CDF as an approx of switch */

/* Regime 1 */
y1 = int1 + zlag(starts)*b11 + decjanfeb *b13 ;
/* Regime 2 */
y2 = int2 + zlag(starts)*b21 + decjanfeb *b23 ;
/* Composite regression equation */
starts = (1 - d)*y1 + d*y2;

/* Resulting log-likelihood function */
logL = (1/2)*( (318*log(2*3.1415)) +
log( (sig1**2)*((1-d)**2)+(sig2**2)*(d**2) )
+ (resid.starts*( 1/( (sig1**2)*((1-d)**2)+
(sig2**2)*(d**2) ) )*resid.starts) ) ;

errormodel starts ~ general(logL);

fit starts / method=marquardt converge=1.0e-5;

/* Test for significant differences in the parms */
test int1 = int2 ,/ lm;
test b11 = b21 ,/ lm;
test b13 = b23 ,/ lm;
test sig1 = sig2 ,/ lm;

trubador
Did you use forum search?
Posts: 1520
Joined: Thu Nov 20, 2008 12:04 pm

Re: Switching regression

Postby trubador » Sat Oct 24, 2009 7:01 am

Here is an example in EViews. You can work through the example and modify it to suit your own need...


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests