Page 1 of 1

de-meaned regression

Posted: Tue Jul 20, 2010 4:21 pm
by hbana
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 :(

Re: de-meaned regression

Posted: Tue Jul 20, 2010 4:48 pm
by startz
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))

Re: de-meaned regression

Posted: Tue Jul 20, 2010 5:11 pm
by EViews Glenn
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.

Re: de-meaned regression

Posted: Tue Jul 20, 2010 5:17 pm
by startz
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).

Re: de-meaned regression

Posted: Wed Jul 21, 2010 8:26 am
by EViews Glenn
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).