I have a panel dataset taken from the Mexican Population Census where the observations are localities (unique_id) observed every five years (variable year, taking values 1990, 1995, 2000...). It is a balanced dataset as it is.
What I want to do is to interpolate all of these variables - filling in the values between each census year for every locality. My desired end result is a panel of my localities where the localities are observed yearly, rather than every five years (and the values for the four years in between are created using ipolate).
However, my understanding is that usually ipolate is applied to panel datasets where all the yearly observations are already present (but with missing values) and the job is about filling them in (rather than creating them anew!). In my case, the problem is in fact that I'd somehow have to "copy" observations before filling them in. Is there a straightforward way to do this?
Just to make this more concrete, my current dataset is like this:
unique_id | year | variable |
1 | 1990 | 2 |
1 | 1995 | 12 |
1 | 2000 | 22 |
1 | 2005 | 32 |
1 | 2010 | 42 |
2 | 1990 | 52 |
2 | 1995 | 62 |
unique_id | year | variable |
1 | 1990 | 2 |
1 | 1991 | 4 |
1 | 1992 | 6 |
1 | 1993 | 8 |
1 | 1994 | 10 |
1 | 1995 | 12 |
1 | 1996 | 14 |
1 | 1997 | 16 |
1 | 1998 | 18 |
I do hope this is clear, but do not hesitate to let me know if it isn't.
Thank you all for your help!
0 Response to Ipolate on panel data creating observations rather than filling them in
Post a Comment