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: RE: Impute an average in a stacked dataset
From 
 
Nick Cox <[email protected]> 
To 
 
"'[email protected]'" <[email protected]> 
Subject 
 
st: RE: Impute an average in a stacked dataset 
Date 
 
Tue, 6 Sep 2011 15:06:05 +0100 
I'd call this panel data. I think what you want is better called interpolation. 
You can do this with -ipolate-. 
I am not clear about your general rule here. Is that you want to fill in gaps of length 1 _only_? 
It sounds as if you want to cross-correlate within panels and also pool panels. You _could_ do something like this: 
. tsset case yr 
. gen x4 = L4.x 
. corr x x4 
But that's a difficult one to make inferences about given the structure. 
Nick 
[email protected] 
Huerta, Tim
I have a stacked dataset with missing data
Yr   case     x
2004  1                   3
2005  1                  3
2006  1       4
2007  1       6
2004  2       4
2006  2       5
2007  2       7
I want to impute the value in 2005 for case 2 as the average between the value in 2004 and 2006 if and only if data exists in those years.
On another note, it would be nice to run a cross-year correlation, but I can't figure that out either. How do the values in 2004 correlate with the values in 2008?
*
*   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/