Announcement

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

  • How do i compute the geometric increase rate of a variable in a panel dataset?

    Hello everyone, I'm new to Stata and this forum. If I do something wrong, please tell me.
    I would like to calculate the geometric increase rate of a variable in a panel dataset, and I don't know how to do it.
    I'd like to do it with this formula : g_a_i = (a_i/a_1)^(1/(i-1))-1 wherein i = 1,2,3...n and n is the num of obs of each section.

  • #2
    Show a sample of your data using -dataex-.

    Otherwise you can refer to observations by the system variable _n , and to variables at given observations by x[1] say.

    Comment


    • #3
      Originally posted by Joro Kolev View Post
      Show a sample of your data using -dataex-.

      Otherwise you can refer to observations by the system variable _n , and to variables at given observations by x[1] say.
      input byte id int year float(y k) long l
      1 2003 . 6357.38 362040
      1 2004 21412.73 8222.65 348300
      1 2005 22420 10513.46 334420
      1 2006 24040 13221.307 319410
      1 2007 28627 16571.922 307310
      1 2008 33702 21570.13 299230
      1 2009 35226 28378.75 288900
      1 2010 40533.6 36188.336 279310
      1 2011 47486.2 44801.38 265940
      1 2012 52373.6 55618.58 257730
      1 2013 56973.6 68874.91 241710
      1 2014 60165.7 89642.1 227900
      1 2015 62911.8 110326.23 219190
      1 2016 65975.7 134738.03 214960
      1 2017 64660 160907.1 209440
      2 2003 . 10772.295 4883
      2 2004 7628.26 13125.11 5007
      2 2005 10318.24 16660.01 5092
      2 2006 12082.87 21271.77 5297
      2 2007 13460.7 27065.48 5350
      2 2008 19629.4 34663.02 5404
      2 2009 16726 43735.16 5537
      2 2010 20936.6 54561.12 5620
      2 2011 27225.6 66089.88 6116
      2 2012 27081.8 79126.32 6310
      2 2013 25467.6 93460.61 6365
      2 2014 23417.1 106057.57 5965
      2 2015 19104.5 118604.14 5458
      2 2016 18260.4 128450.03 4909
      2 2017 21025.5 137146.33 4554
      3 2003 . 60626.98 29805
      3 2004 51748.5 79969.97 30508
      3 2005 60117.99 106226.1 32109
      3 2006 71212.89 139890.69 33516
      3 2007 87464.95 183836.23 34654
      3 2008 102539.5 239803.3 34343
      3 2009 110118.5 309456.97 34919
      3 2010 130325 396838.3 36372
      3 2011 150597.2 497963.9 40883
      3 2012 161326.1 620522 42622
      3 2013 181867.8 765744.9 52579
      3 2014 195620.3 943052.4 52431
      3 2015 202420.1 1119650.5 50687
      3 2016 214289.3 1303134 48938
      3 2017 240505.4 1491631.5 46355
      4 2003 . 20316.205 2976
      4 2004 5833.26 26030.04 3006
      4 2005 6794.56 33480.32 2999
      4 2006 8015.18 41932.1 3025
      4 2007 9609.22 51231.97 3034
      4 2008 8091.3 62024.24 3065
      4 2009 8395.4 76210.74 3077
      4 2010 9460.6 91585.6 3105
      4 2011 10647.4 105878.96 3347
      4 2012 11262.7 122128.14 3446
      4 2013 15002.2 141274.33 4045
      4 2014 14819 167432.03 4037
      4 2015 14981.7 193485.1 3960
      4 2016 15328 222458.88 3876
      4 2017 16797.2 251374.63 3770
      5 2003 . 6286.254 8337
      5 2004 8694.28 7225.11 8410
      5 2005 10367.31 8315.21 9266
      5 2006 12408.61 9407.45 9887
      5 2007 15296.48 10672.12 10508
      5 2008 18743.2 12185.33 10726
      5 2009 22398.8 14129.09 11775
      5 2010 26661 16874.77 12675
      5 2011 31942.7 20164.37 17248
      5 2012 35491.3 23822.72 20103
      5 2013 40896.8 27397.22 29219
      5 2014 44880.5 32244.24 29212
      5 2015 46626.7 37071.86 27960
      5 2016 49702.9 41538.47 27247
      5 2017 55313.8 45211.22 26432
      6 2003 . 3414.702 6281
      6 2004 12453.77 4674.04 6318
      6 2005 13966.18 6371.75 6139
      6 2006 16530.72 8611.56 6127
      6 2007 20937.84 11457.41 6231
      6 2008 26182.3 15153.38 6273
      6 2009 28984.5 20225.57 6344
      6 2010 35746.1 26176.87 6311
      6 2011 43445.2 33511.56 6628
      6 2012 49394.4 43188.21 7118
      6 2013 56284.1 55735.96 8908
      6 2014 62423.5 74437.92 8886
      6 2015 66186.7 93065.07 8833
      6 2016 71290.7 110859.7 8750
      6 2017 77658.2 127196.17 8428
      7 2003 . 29008.21 6365
      7 2004 9304.39 36538.38 1237
      7 2005 10666.16 46006.23 1301
      7 2006 12182.98 57960.3 1382
      7 2007 14601.04 71882.46 1502
      7 2008 16362.5 88619.33 1595
      7 2009 16727.1 113239.55 1738
      7 2010 19132.2 142861.1 1858
      7 2011 22432.8 170581.34 2128
      7 2012 24660 201343.9 6675
      Hi, here is my data. I'd like to compute (y[year]/y[year==2003])^(1/(year-2003) for every year between 2003 and 2017 for each id.
      _n is a good variable however it doesn't work for panel data.

      Comment


      • #4
        Since your your value of y is missing in each panel for year 2003, it isn't possible to compute what you want for y. The following uses k instead, and computes its geometric growth rate.
        Code:
        sort id year
        by id (year): assert year[1]==2003
        by id (year): generate wanted = (k/k[1]) ^ (1/(year-2003)) - 1 if year>2003

        Comment

        Working...
        X