Dear Listserv Readers—
I’m extrapolating using a cross-national time-series dataset, and want to limit the number of years I extrapolate out on a country-by-country basis (so that the extrapolated data doesn’t go on indefinitely for like 40 years).
My cases/observations are country-years, and I have about 75 years per country in my dataset. One of my independent variables (hoji) is for average attitudes. For hoji, I have one to eight observations per country. (These observations are randomly spaced out over the course of 35 years.) To try and “fill in” the data for missing years, I have tried interpolating AND extrapolating the data. For countries with only one data point, I have also made up a way to fill in that single data point across every year. (See my Stata code BELOW, where cno is the name of the country and hojie is the new variable generated.) I’m using Stata 13.
My problem is, I'm not super-confident about the resulting data. (1) For the extrapolated data, I want to limit things, so that the data are only extrapolated five years out from the last existing actual data point. (2) Similarly, for countries with only data point, I want to fill in that data point only five years before and after the year in which the actual observation occurred. …Does anyone know how I might do this?
Thanks!
Louisa
Here’s the code I’m using now:
by cno: ipolate hoji year, generate(hojie1) epolate
by cno: egen hojie1plus = min(hojie1)
gen hojie = hojie1
replace hojie= hojie1plus if hojie1==.
label var hojie "hojust interp, extrap & means for 1-obs cases"
(P.S. It looks like the user-written mipolate command might be a good one here. But again, I can’t figure out how to limit the number of years extrapolated or filled out.)
I’m extrapolating using a cross-national time-series dataset, and want to limit the number of years I extrapolate out on a country-by-country basis (so that the extrapolated data doesn’t go on indefinitely for like 40 years).
My cases/observations are country-years, and I have about 75 years per country in my dataset. One of my independent variables (hoji) is for average attitudes. For hoji, I have one to eight observations per country. (These observations are randomly spaced out over the course of 35 years.) To try and “fill in” the data for missing years, I have tried interpolating AND extrapolating the data. For countries with only one data point, I have also made up a way to fill in that single data point across every year. (See my Stata code BELOW, where cno is the name of the country and hojie is the new variable generated.) I’m using Stata 13.
My problem is, I'm not super-confident about the resulting data. (1) For the extrapolated data, I want to limit things, so that the data are only extrapolated five years out from the last existing actual data point. (2) Similarly, for countries with only data point, I want to fill in that data point only five years before and after the year in which the actual observation occurred. …Does anyone know how I might do this?
Thanks!
Louisa
Here’s the code I’m using now:
by cno: ipolate hoji year, generate(hojie1) epolate
by cno: egen hojie1plus = min(hojie1)
gen hojie = hojie1
replace hojie= hojie1plus if hojie1==.
label var hojie "hojust interp, extrap & means for 1-obs cases"
(P.S. It looks like the user-written mipolate command might be a good one here. But again, I can’t figure out how to limit the number of years extrapolated or filled out.)
Comment