de-meaned regression

For questions regarding programming in the EViews programming language.

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

hbana
Posts: 2
Joined: Wed Jun 30, 2010 5:43 pm

de-meaned regression

Postby hbana » Tue Jul 20, 2010 4:21 pm

I'm new to Eviews programming which seems so difficult!!

Could someone please indicate how to conduct a regression of de-meaned lagged values?

As far as I can understand the equation should be something like this:

ls(n) y-@mean(y)=c(1)+c(2)*x-@mean(x)(-1)

my dependent variable needs to be = y minus sample mean of y
and independent variable is = x minus sample mean of x (the whole thing is lagged by 1)

When i try to run the regression i get syntax error or near singular matrix error :(

startz
Non-normality and collinearity are NOT problems!
Posts: 3797
Joined: Wed Sep 17, 2008 2:25 pm

Re: de-meaned regression

Postby startz » Tue Jul 20, 2010 4:48 pm

I'm new to Eviews programming which seems so difficult!!

Could someone please indicate how to conduct a regression of de-meaned lagged values?

As far as I can understand the equation should be something like this:

ls(n) y-@mean(y)=c(1)+c(2)*x-@mean(x)(-1)

my dependent variable needs to be = y minus sample mean of y
and independent variable is = x minus sample mean of x (the whole thing is lagged by 1)

When i try to run the regression i get syntax error or near singular matrix error :(
you probably want

Code: Select all

ls(n) y-@mean(y)=c(1)+c(2)*(x(-1)-@mean(x(-1))

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: de-meaned regression

Postby EViews Glenn » Tue Jul 20, 2010 5:11 pm

One issue you have to be a bit careful of is the sample over which the means are taken. As written, the mean of the y variable will be taken over the full sample while the mean of the x will be taken over the subsample where x(-1) is non-missing, which may or may not be what you want. These samples may very well differ.

The following is a slightly easier form of the regression which uses the list specification form:

Code: Select all

smpl if y<>na and x(-1)<>na ls(n) y-@mean(y) x-@mean(x(-1))
Note the absence of spaces in the expressions. If you want spaces, you should enclose in parentheses as needed. If you don't want to enforce the sample restriction on the means, simply remove the "smpl" statement.

startz
Non-normality and collinearity are NOT problems!
Posts: 3797
Joined: Wed Sep 17, 2008 2:25 pm

Re: de-meaned regression

Postby startz » Tue Jul 20, 2010 5:17 pm

And in following Glenn's advice, be careful as to whether you want X minus mean(lagged X) or (lagged X) minus mean(lagged X).

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: de-meaned regression

Postby EViews Glenn » Wed Jul 21, 2010 8:26 am

I should point out that in my comments I took the original specification literally, with X minus mean(lagged X). Note that if all you want to do is to take lagged X - mean(lagged X), you might as well just include a constant and remove the demeaning since you'll get identical results (unless there is a very specific reason that you wish to demean first).


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 1 guest