Announcement

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

  • Extrapolating several values

    Hi, I have county-level data (variable "id2") of median age (variable "medage") for three years (variable "y," written as "1" for 2000, "3" for 2008, and "4" for 2012 ). I am trying to extrapolate this data to 2016 ("y" 5) individually by county.
    I have my data so that it can be reshaped into wide or long form

    I've tried to use this (long form data):

    sort id2 y
    tsset id2 y
    tsappend, add(1)
    xi: reg medage i.id2*y
    predict medage2016

    and this (short form) from which I could find out how to :

    by id2: regress medage2012 medage2000 medage2008

    In the second example, stata says that there are not enough observations to complete the regression. In the first example, I still can't quite figure out what is happening, but it involves creating several variables and interpolating the results.

    I also tried using the ipolate function by creating a missing variable for all values in 2016 and using "by id2:" In this case, stata said there were too many variables...I guess the ipolate function is only for two points of observations?

    Any suggestions, or is something written wrong?

    Thanks!

  • #2
    ok, I've figured out that by using the first option in long form:
    sort id2 y
    tsset id2 y
    tsappend, add(1)
    xi: reg medage i.id2*y
    predict medage2016

    the new medage2016 variable has the predicted median age values at all y values (including the missing "2" values for unknown 2004 data).

    i have several variables to extrapolate, so I've repeated the last two lines when all of these have been created, i will create a lag variable that will help me separate the predicted 2004 observations from the 2016 observations, then combine the extrapolated 2016 values so that each county has an observation for 2016.

    Comment

    Working...
    X