Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: residuals when no variation in Y
From
Raymond Lim <[email protected]>
To
[email protected]
Subject
st: residuals when no variation in Y
Date
Sun, 15 Jan 2012 21:14:58 -0500
I have 2 panels with 4 time periods. For panel A, Y=0 in every period.
For panel B, Y has variation. I regress Y on a linear time trend.
If I regress with just panel A, I get no results as expected. If I do
a fixed effect regression with both panels, then calculate the
residuals, panel A's residuals are non-zero. Where are these residuals
coming from if there is no within-variation in the Y variable?
CODE TO ILLUSTRATE:
clear all
input panel y time
1 0 2001
1 0 2002
1 0 2003
1 0 2004
2 4 2001
2 8 2002
2 7 2003
2 3 2004
end
reg y time if panel==1
areg y time, a(panel)
predict resid, resid
list, sepby(panel)
OUTPUT IN THE END
. list, sepby(panel)
+--------------------------+
| panel y time resid |
|--------------------------|
1. | 1 0 2001 -.3 |
2. | 1 0 2002 -.1 |
3. | 1 0 2003 .1 |
4. | 1 0 2004 .3 |
|--------------------------|
5. | 2 4 2001 -1.8 |
6. | 2 8 2002 2.4 |
7. | 2 7 2003 1.6 |
8. | 2 3 2004 -2.2 |
+--------------------------+
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/