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

  • Detrended variable in a panel dataset

    Dear Stata listers,

    I have a panel-dataset which includes companies (different variables) and their salaries over the time period from 2004 to 2014.
    The salaries are not given in absolut numbers, but in relative numbers. ("salary year t / salary of the year with the maximum salary").

    Now I want to detrend the variable "salary".

    Other internet forums suggest following code:

    generate Trend = YEAR - 2003
    reg Salary Trend
    predict Salary_detrend, resid

    In consideration of the panel data set, I have now the question, if I can use this code?

    Or should I use the following code for my panel dataset?

    xtreg Salary Trend, fe vce (cluster ID)
    predict Salary_detrend_fe, e

    Can someone help me on this? Thank you.

  • #2
    You can certainly do this, but I would try something else. If Salary is to be your dependent variable I would use the logs. Then I would include a full set of year dummy variables in my model. There's no need to detrend first.

    There is no difference between OLS, random effects, and fixed effects when you just regression on functions of time. So if your only goal is to detrend then just use your first set of commands. I linear trend for a level may not be the best model, but it might fit well enough over the period especially because it's relative to the max (which I also find a bit peculiar).