Page 1 of 1

Code for estimating equation for different values of a certain variable and storing residuals

Posted: Mon Mar 19, 2018 12:41 am
by AnwaarAlam92
Hello!

I am estimating a threshold model of the form: y = c + a*x(z<theta) + b*x(z>=theta)

where z lowest value< theta <z highest value

what I want to do is to estimate this model for all values of "z" variable starting from the lowest value to the highest value, and storing the SSR of each regression along with the value of "z" variable used in the regression.

so lets suppose the lowest value of z is 0.5 and 2nd lowest is 0.6 I want to estimate y = c + a*x(z<0.5) + b*x(z>=0.5) and y = c + a*x(z<0.6) + b*x(z>=0.6) respectively, upto the highest value of z.

I am new to eviews programming so any suggestions would really help me learn the programming syntax.

Re: Code for estimating equation for different values of a certain variable and storing residuals

Posted: Mon Mar 19, 2018 7:35 am
by EViews Gareth

Re: Code for estimating equation for different values of a certain variable and storing residuals

Posted: Mon Mar 19, 2018 7:49 am
by AnwaarAlam92
So far I have done this

vector v = @convert(z)

vector v1 = @sort (v,"a","i")



'set buffer on either side of sample
!j=11

for !i=!j to v1.@rows-!j

equation eq{!i}.ls y = c(1) + c(2)*x*(z<(v1(!i))) + c(3)*x*(z(-1)>=(v1(!i)))


eq{!i}.makeresids res{!i}



next



its working :D