Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Interpolation/Extrapolation with panel data

    Greetings,

    I am currently analyzing a strongly balanced panel and I need to extrapolate a variable based on its strong dependency on another variable in my dataset. Normally, I have 2000-2014 data for each country, but in some cases I only have 2009-2014 data.
    My code is:

    corr GDPperCapita M3
    ipolate M3 GDPperCapita, generate(M3_ipolate) epolate


    However, looking at the results I obtained and searching through the explanation of the ipolate and epolate commands, I am unsure whether Stata understands that there is an existing panel trend that it should use when computing the extrapolation (meaning, that I have Countries and for each country I have 2000-2014 data - of course my data are xtset).

    Thanks in advance for your help!

  • #2
    Stata understands you to mean what you said. You are interpolating on M3 as a function of GDP, regardless of any panel setting. There is no hidden, still less explicit, catch in the code that any panel set-up is automatically respected There are several ways to see or know this. One is to look at the code. Another is to know that any method that respects (or requires) panel settings will be documented as such. Another is to look at the results.

    You have a different problem is that it's hard to imagine that linear interpolation, which is utterly sensitive to local quirks in the data, is the best way to do this.

    Comment


    • #3
      No, -ipolate- is not aware of the panel structure in your data; it does not look at -xtset-. But it does allow the -by()- option. So
      Code:
      by country, sort: ipolate ...
      should do what you want.

      Added: Crossed with Nick's response. He makes the same point I do and also adds a warning that linear interpolation/extrapolation may not be a good idea in this setting. I concur.

      Comment


      • #4
        so what is better than linear interpolation ?

        Comment


        • #5
          What can be better than linear interpolation is whatever rule works better than a local linear rule. In the case of #1 the problem seems to call for a model fit to the dataset, not piecewise interpolation.

          Comment


          • #6
            you mean interpolating missing data through a regression model predicting the missing values, right? what if this variable is already used to validate a regression model? so we are feeding the model by its outcomes sounds like validity has been assumed already
            thanks in advance
            Last edited by Nariman Sayed; 24 Dec 2022, 10:45.

            Comment

            Working...
            X