Announcement

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

  • Growth rate of a variable

    Hello
    I have panel data and I want to calculate growth rate of a variable in my dataset.
    Need help

    Thanks

  • #2
    Ludmila:
    if you're looking for the growth rate of a given variable regardless the -timevar-, you may want to try:
    Code:
    use "http://www.stata-press.com/data/r14/nlswork.dta", clear
    bysort ln_wage: g growth_rate=(ln_wage[_n]-ln_wage[_n-1])/ln_wage[_n-1] if _n!=1 & ln_wage!=.
    .

    If you're looking for the growth rate of a given variable rconsidering the -timevar-, you may want to try:

    Code:
    use "http://www.stata-press.com/data/r14/nlswork.dta", clear
    bysort ln_wage (year): g growth_rate=(ln_wage[_n]-ln_wage[_n-1])/ln_wage[_n-1] if _n!=1 & ln_wage!=.
    .
    Kind regards,
    Carlo
    (Stata 18.0 SE)

    Comment


    • #3
      Sorry Carlo, I have to object. Your code sorts the data by ln_wage (in both cases, because ln_wage is listed first after bysort in your second version) and thus does not compute growth rates over time. Furthermore, since ln_wage is already in logs, the growth rate of wage could be approximated by the simple difference of the logs. Your new variable instead would become a growth rate of the log of wage, which is usually not of interest.

      Given that Ludmila has panel data and assuming that it is properly xtset, it would be best to make use of the time-series operators, e.g.:
      Code:
      . webuse abdata
      . gen g_wage = D.wage / L.wage
      or as log-approximation:
      Code:
      . webuse abdata
      . gen l_wage = ln(wage)
      . gen g_wage = D.l_wage
      https://twitter.com/Kripfganz

      Comment


      • #4
        Sebastian:
        you're right.
        I have overlooked that ln_wage was, as is should, logged (and that implies logs properties, in turn).
        Glad you were right in objecting!
        Last edited by Carlo Lazzaro; 26 Mar 2017, 06:41.
        Kind regards,
        Carlo
        (Stata 18.0 SE)

        Comment


        • #5
          Thank you Carlo and Sebastian
          Last edited by Ludmila Farooq; 27 Mar 2017, 01:43.

          Comment


          • #6
            Hello Again
            I want to do "growth accounting" and find out the contribution of different factors in the growth of a variable.
            should I just run a simple regression of variables in growth form?

            Comment

            Working...
            X