I am currently working with unbalanced panel data which I need to prepare for regressions. Since only yearly data is available, I have to interpolate the values for some variables, such as loans, to get quaterly data. The observations are aggregated to groups with a unique group-ID (newid) and the data is formated as a time series (tsset).
Since I have to deal with unbalanced panel data, some years in the time series are missing. I worry about missing years somewhere in the middle of the sequence, e.g. if 2004 and 2006 are available, but 2005 not. Therefore, my questions are:
1. After using tsspell, I have seen that some groups have several spells (up to 3). Is it possible to incorporate this information in the ipolate command, e.g. by creating new subgroup IDs? I thought that they could refer to one sequence before a spell occurs. How should I implement it technically?
2. Is there a common approach in such a case?
So far, I have been using:
by newid: ipolate loans dateq, generate (loans2)
Data example with one (three) spells within different groups:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(newid dateq) byte(_spell _seq _end) float loans2 395 176 1 1 0 . 395 177 1 2 0 . 395 178 1 3 0 . 395 179 1 4 0 15576 395 180 1 5 0 . . . . 396 204 3 1 0 . 396 205 3 2 0 . 396 206 3 3 0 . 396 207 3 4 0 605 396 208 3 5 0 . 396 209 3 6 0 . 396 210 3 7 0 . 396 211 3 8 0 511 . end format %tq dateq
I am using Stata 15.0
Thank you a lot in advance!
Eva
0 Response to Interpolation of unbalanced panel data
Post a Comment