Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: Impute an average in a stacked dataset

From   Nick Cox <>
To   "''" <>
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. 


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:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index