Announcement

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

  • Perpetual Inventory Method

    Dear all,

    I am trying to calculate capital stock per industry country year from Gross Fixed Capital Formation using the perpetual inventory method (PIM) . However, my panel is unbalanced with many gaps. The command TSPELL is suggested but I still do not know how to properly interpolate the missing observations (in that way I cannot use the package stockcapit). Any advice? Any suggested command?

    Attempted calculation ( I assumed a 6% depreciation rate and average of 10 years of growth as a post here assumed though this could be changed obviously)




    xtset country_industry year
    by country_industry, sort: egen myear=min(year) if gfcf~=.
    by country_industry, sort: ipolate GrossFixedAsset year, gen(gfcf)
    by country_industry, sort: gen growth=(gfcf-L.gfcf)/L.gfcf
    by country_industry, sort: replace growth=0 if growt<0
    by country_industry, sort: egen agrowth=mean(growth) if year<(myear+10)
    by country_industry, sort: gen capital=gfcf/(agrowth+0.06)
    by country_industry, sort: replace capital=. if year>myear
    by country_industry, sort: replace capital=((0.94*L.capital)+gfcf2) if year>myear




    ----------------------- copy starting from the next line -----------------------
    Code:
     * Example generated by -dataex-. To install: ssc install dataex
    clear
    input int(country year) double HHI float total_output_per_worker str2 isic float l_output_per_worker str3 isiccomb byte sourcecode long(Establishments Employment) double(Wages OutputINDSTAT4 ValueAdded GrossFixed) long FemaleEmployees
    4 2002 0 10217.693 "15"  8.747895 "15" 3  57 1398  1416229  8803794 . .  270
    4 2003 0 10445.018 "15"  7.318273 "15" 3  68 1986  1857237  2994088 . .  384
    4 2004 0   20834.7 "15"  8.145588 "15" 3  60 2170  2177016  7482447 . .  720
    4 2005 0  46658.26 "15"  8.626478 "15" 3 152 4376  4461093 24406704 . .  561
    4 2006 0 37563.043 "15"  8.591387 "15" 3 199 5278  5400385 28422446 . .  901
    4 2007 0  46911.16 "15"  8.826547 "15" 3 206 5300  6110242 36107429 . . 1237
    4 2008 0  45425.82 "15"  8.789159 "15" 3 212 5431  6415492 35642064 . .  899
    4 2009 0  47342.36 "15" 9.0298605 "15" 3 199 5400  6824441 45082961 . .  870
    4 2010 0  56009.59 "15"  9.015374 "15" 3 195 4893  6952011 40262668 . .  912
    4 2011 0  57938.96 "15"  9.184711 "15" 3 197 4901  7171111 47769902 . . 1008
    4 2012 0  55109.59 "15"  9.215193 "15" 3 192 4790  6604296 48133005 . .    .
    4 2013 0  51003.87 "15"  9.107686 "15" 3 189 4368  5679202 39418536 . .    .
    4 2014 0         0 "15"         . "15" 3   .    .        .        . . .    .
    4 2015 0         0 "15"         . "15" 5   .    .        . 37204964 . .    .
    4 2018 0         0 "15"         . "15" 3   .    .        . 45838668 . .    .
    4 2019 0         0 "15"         . "15" 3   .    .        . 64888180 . .    .
    4 2002 0 10217.693 "16"         . "16" 0   .    .        .        . . .    .
    4 2003 0 10445.018 "16"         . "16" 0   .    .        .        . . .    .
    4 2004 0   20834.7 "16"         . "16" 0   .    .        .        . . .    .
    4 2005 0  46658.26 "16"         . "16" 0   .    .        .        . . .    .
    4 2006 0 37563.043 "16"         . "16" 0   .    .        .        . . .    .
    4 2007 0  46911.16 "16"         . "16" 0   .    .        .        . . .    .
    4 2008 0  45425.82 "16"         . "16" 0   .    .        .        . . .    .
    4 2009 0  47342.36 "16"         . "16" 0   .    .        .        . . .    .
    4 2010 0  56009.59 "16"         . "16" 0   .    .        .        . . .    .
    4 2011 0  57938.96 "16"         . "16" 0   .    .        .        . . .    .
    4 2012 0  55109.59 "16"         . "16" 0   .    .        .        . . .    .
    4 2013 0  51003.87 "16"         . "16" 0   .    .        .        . . .    .
    4 2014 0         0 "16"         . "16" 0   .    .        .        . . .    .
    4 2015 0         0 "16"         . "16" 0   .    .        .        . . .    .
    4 2018 0         0 "16"         . "16" 3   .    .        .    90174 . .    .
    4 2019 0         0 "16"         . "16" 3   .    .        .   125441 . .    .
    4 2002 0 10217.693 "17"  7.574063 "17" 3  11  830   937303  1616039 . .  710
    4 2003 0 10445.018 "17"  7.269464 "17" 3  22 2371  2443135  3404238 . . 1800
    4 2004 0   20834.7 "17"  7.333825 "17" 3   8 1870  1876046  2863394 . . 1709
    4 2005 0  46658.26 "17"  8.177107 "17" 3  31 4474  4558073 15920929 . . 3900
    4 2006 0 37563.043 "17"  8.109082 "17" 3  49 5808  6282021 19308835 . . 5000
    4 2007 0  46911.16 "17"  7.999135 "17" 3  57 6700  7724268 19955159 . . 5908
    4 2008 0  45425.82 "17"  7.875694 "17" 3  64 6917  8424423 18209095 . . 6010
    4 2009 0  47342.36 "17"  7.155516 "17" 3  66 6902  8722683  8842524 . . 6030
    4 2010 0  56009.59 "17"  8.021594 "17" 3  66 6820  9689906 20773926 . . 6048
    4 2011 0  57938.96 "17"  8.020756 "17" 3  68 6853 10027273 20856950 . . 6120
    4 2012 0  55109.59 "17"  8.017647 "17" 3  68 6749  9288826 20476656 . .    .
    4 2013 0  51003.87 "17" 8.0116005 "17" 3  66 6222  8089928 18763938 . .    .
    4 2014 0         0 "17"         . "17" 3   .    .        .        . . .    .
    4 2015 0         0 "17"         . "17" 5   .    .        . 17710238 . .    .
    4 2018 0         0 "17"         . "17" 3   .    .        .  1502430 . .    .
    4 2019 0         0 "17"         . "17" 3   .    .        .  2951999 . .    .
    4 2002 0 10217.693 "18"         . "18" 0   .    .        .        . . .    .
    4 2003 0 10445.018 "18"         . "18" 0   .    .        .        . . .    .
    4 2004 0   20834.7 "18"         . "18" 0   .    .        .        . . .    .
    4 2005 0  46658.26 "18"         . "18" 0   .    .        .        . . .    .
    4 2006 0 37563.043 "18"         . "18" 0   .    .        .        . . .    .
    4 2007 0  46911.16 "18"         . "18" 0   .    .        .        . . .    .
    4 2008 0  45425.82 "18"         . "18" 0   .    .        .        . . .    .
    4 2009 0  47342.36 "18"         . "18" 0   .    .        .        . . .    .
    4 2010 0  56009.59 "18"         . "18" 0   .    .        .        . . .    .
    4 2011 0  57938.96 "18"         . "18" 0   .    .        .        . . .    .
    4 2012 0  55109.59 "18"         . "18" 0   .    .        .        . . .    .
    4 2013 0  51003.87 "18"         . "18" 0   .    .        .        . . .    .
    4 2014 0         0 "18"         . "18" 0   .    .        .        . . .    .
    4 2015 0         0 "18"         . "18" 0   .    .        .        . . .    .
    4 2018 0         0 "18"         . "18" 3   .    .        .     4162 . .    .
    4 2019 0         0 "18"         . "18" 3   .    .        .   709515 . .    .
    4 2002 0 10217.693 "19"         . "19" 0   .    .        .        . . .    .
    4 2003 0 10445.018 "19"         . "19" 0   .    .        .        . . .    .
    4 2004 0   20834.7 "19"         . "19" 0   .    .        .        . . .    .
    4 2005 0  46658.26 "19"         . "19" 0   .    .        .        . . .    .
    4 2006 0 37563.043 "19"         . "19" 0   .    .        .        . . .    .
    4 2007 0  46911.16 "19"         . "19" 0   .    .        .        . . .    .
    4 2008 0  45425.82 "19"         . "19" 0   .    .        .        . . .    .
    4 2009 0  47342.36 "19"         . "19" 0   .    .        .        . . .    .
    4 2010 0  56009.59 "19"         . "19" 0   .    .        .        . . .    .
    4 2011 0  57938.96 "19"         . "19" 0   .    .        .        . . .    .
    4 2012 0  55109.59 "19"         . "19" 0   .    .        .        . . .    .
    4 2013 0  51003.87 "19"         . "19" 0   .    .        .        . . .    .
    4 2014 0         0 "19"         . "19" 0   .    .        .        . . .    .
    4 2015 0         0 "19"         . "19" 3   .    .        .        . . .    .
    4 2018 0         0 "19"         . "19" 3   .    .        .   516070 . .    .
    4 2019 0         0 "19"         . "19" 3   .    .        .  1153161 . .    .
    4 2002 0 10217.693 "20"  5.704612 "20" 3  14  723   742413   217080 . .    .
    4 2003 0 10445.018 "20"  6.857589 "20" 3  10  690   645247   656239 . .    .
    4 2004 0   20834.7 "20"  8.450139 "20" 3  18  970   973136  4535449 . .    .
    4 2005 0  46658.26 "20"  8.513929 "20" 3  43 1500  1425610  7475563 . .    .
    4 2006 0 37563.043 "20"  8.363229 "20" 3  47 1785  1827930  7651426 . .    .
    4 2007 0  46911.16 "20"   8.49775 "20" 3  50 1600  1844601  7845960 . .    .
    4 2008 0  45425.82 "20"  8.474675 "20" 3  45 1520  1923836  7283638 . .    .
    4 2009 0  47342.36 "20"  8.501992 "20" 3  37 1497  1891744  7372081 . .    .
    4 2010 0  56009.59 "20"  8.804634 "20" 3  32 1405  1996234  9364412 . .    .
    4 2011 0  57938.96 "20"   8.65987 "20" 3  30 1405  2055789  8102337 . .    .
    4 2012 0  55109.59 "20"  8.081789 "20" 3  28 1378  1899005  4457851 . .    .
    4 2013 0  51003.87 "20"  8.173073 "20" 3  25 1126  1462688  3990790 . .    .
    4 2014 0         0 "20"         . "20" 3   .    .        .        . . .    .
    4 2015 0         0 "20"         . "20" 3   .    .        .        . . .    .
    4 2018 0         0 "20"         . "20" 3   .    .        .    45780 . .    .
    4 2019 0         0 "20"         . "20" 3   .    .        .   296077 . .    .
    4 2002 0 10217.693 "21"         . "21" 0   .    .        .        . . .    .
    4 2003 0 10445.018 "21"         . "21" 0   .    .        .        . . .    .
    4 2004 0   20834.7 "21"         . "21" 0   .    .        .        . . .    .
    4 2005 0  46658.26 "21"         . "21" 0   .    .        .        . . .    .
    end
    Last edited by Hugo Rocha; 21 Mar 2022, 21:29.

  • #2
    Hugo:
    see -ipolate-.
    That said, intepolating missing vaues, albeit technically feasible, may end up as a making-up of your data.
    Kind regards,
    Carlo
    (StataNow 18.5)

    Comment


    • #3
      Hi Carlo,

      Thanks
      I used ipolate in the command. However, I would like to make sure I am calculating it the right way. Is this appropriate for the Perpetual Inventory Method? In the line "by country isic year, sort: gen growth=(gfcf-L.gfcf)/L.gfcf", I get an error (not sorted though I am sorting the data)

      In addition, if I try to use the package stockcapit (not my favorite choice). I get that I still have gaps in the data though I interpolated it before
      Attached Files
      Last edited by Hugo Rocha; 22 Mar 2022, 11:26.

      Comment


      • #4
        Hugo:
        sorry, but I'm not expereinced with those two community-contributed modules.
        Kind regards,
        Carlo
        (StataNow 18.5)

        Comment


        • #5
          Any help?

          Comment

          Working...
          X