Hi,
I have 2 data sets that I have merged. The linked data is yearly data, starting 1996 and the survey dataset is every 3- 4 years starting 1996 then 2000, 2003 ,2006 and so on. The merged data undoubtely has a lot of missing values due to the discrepency in the years the data is collected for and since it is an unbalanced panel. id is individual ID and t is time. I was adviced to use Moving averages (MA) to try and fill the missing values. I need some help here.
FIrst, I am not sure how many lags and leads to use. I am currently using 2 leads but no lags.
Second, how does one take MA for catergorical and binary variables?
I have tired to used ipolate for variables such as age and looked into mipolate as well , any methods recommendation would be appreciated.
Please see the example, of the data below. Thanks in advance.
clear
input double id float t byte c float(age phi_bin gh mh smokingstat)
700001 1996 0 20 0 62 92 1
700001 1997 0 . . . . .
700001 1998 0 . . . . .
700001 1999 0 . . . . .
700001 2000 0 . . . . .
700001 2001 0 . . . . .
700001 2002 0 . . . . .
700001 2003 0 . . . . .
700001 2004 0 . . . . .
700001 2005 0 . . . . .
700001 2006 0 . . . . .
700001 2007 0 . . . . .
700001 2008 0 . . . . .
700001 2009 0 . . . . .
700001 2010 0 . . . . .
700001 2011 0 . . . . .
700001 2012 0 . . . . .
700001 2013 0 . . . . .
700001 2014 0 . . . . .
700001 2015 0 . . . . .
700001 2016 0 . . . . .
700001 2017 0 . . . . .
700001 2018 0 . . . . .
700001 2019 0 . . . . .
700002 1997 0 . . . . .
700002 1998 0 . . . . .
700002 1999 0 . . . . .
700002 2001 0 . . . . .
700002 2002 0 . . . . .
700002 2003 0 29 1 82 88 2
700002 2004 0 . . . . .
700002 2005 0 . . . . .
700002 2006 0 33 1 77 88 1
700002 2007 0 . . . . .
700002 2008 0 . . . . .
700002 2009 0 36 1 90 84 1
700002 2010 0 . . . . .
700002 2011 0 . . . . .
700002 2012 0 . . . . .
700002 2013 0 . . . . .
700002 2014 0 . . . . .
700002 2015 0 42 1 100 92 1
700002 2016 0 . . . . .
700002 2017 0 . . . . .
700002 2018 0 46 1 97 100 1
700002 2019 0 . . . . .
700003 1996 0 21 0 82 80 1
700003 1997 0 . . . . .
700003 1998 0 . . . . .
700003 1999 0 . . . . .
700003 2000 0 25 0 77 84 2
700003 2001 0 . . . . .
700003 2002 0 . . . . .
700003 2003 0 28 0 82 68 1
700003 2004 0 . . . . .
700003 2005 0 . . . . .
700003 2011 0 . . . . .
700003 2012 0 . . . . .
700003 2013 0 . . . . .
700003 2014 0 . . . . .
700003 2015 0 . . . . .
700003 2016 0 . . . . .
700003 2017 0 . . . . .
700003 2018 0 . . . . .
700003 2019 0 . . . . .
700004 1996 0 21 0 82 84 1
700004 1997 0 . . . . .
700004 1998 0 . . . . .
700004 1999 0 . . . . .
700004 2000 0 25 0 82 72 1
700004 2001 0 . . . . .
700004 2002 0 . . . . .
700004 2003 0 . . . . .
700004 2004 0 . . . . .
700004 2005 0 . . . . .
700004 2006 0 31 0 62 64 1
700004 2007 0 . . . . .
700004 2008 0 . . . . .
700004 2009 0 . . . . .
700004 2010 0 . . . . .
700004 2011 0 . . . . .
700004 2012 0 . . . . .
700004 2013 0 . . . . .
700004 2014 0 . . . . .
700004 2015 0 40 1 42 56 1
700004 2017 0 . . . . .
700004 2018 0 . . . . .
700004 2019 0 . . . . .
700005 1996 0 21 0 52 92 5
700005 1997 0 . . . . .
700005 1998 0 . . . . .
700005 1999 0 . . . . .
700005 2000 0 25 0 50 92 4
700005 2001 0 . . . . .
700005 2002 0 . . . . .
700005 2003 0 . . . . .
700005 2004 0 . . . . .
700005 2005 0 . . . . .
700005 2006 0 . . . . .
700005 2007 0 . . . . .
end
label values smokingstat smoke1
label def smoke1 1 "Never smoked", modify
label def smoke1 2 "Ex-smoker", modify
label def smoke1 4 "Smoke 10-19 day", modify
label def smoke1 5 "Smoke >=20 day", modify
[/CODE]
0 Response to Moving Averages Unbalanced Panel data
Post a Comment