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

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Jason, EViews Moderator

AnwaarAlam92
Posts: 2
Joined: Mon Oct 02, 2017 1:13 am

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

Postby AnwaarAlam92 » Mon Mar 19, 2018 12:41 am

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.


AnwaarAlam92
Posts: 2
Joined: Mon Oct 02, 2017 1:13 am

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

Postby AnwaarAlam92 » Mon Mar 19, 2018 7:49 am

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


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 10 guests