Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: How to generate a cumulative sum (capital stock)


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: How to generate a cumulative sum (capital stock)
Date   Fri, 26 Oct 2007 17:18:08 +0100

Austin Nichols has already replied helpfully and you may have solved
your problem. I can't comment helpfully on what went wrong here because
you don't show us exactly what you typed. My code looks good to me. 

A difference between Austin's solution and mine is whether you add
investment at time 1. 

Damiano

Sorry for my first message (yes, I was vague. There was another message
concerning the cumulative sum). I'm writing again because I tried to use
your commands in Stata 9.2 but, as for Austin's suggested program, the
new "k" column is empty! Could you help me to solve this odd result?

> Forgetting the panel aspect for a moment,
> 
> gen K = k
> replace K = 0.95 * K[_n-1] + I in 2/l
> 
> That is, you initialise a variable and
> then -replace- all the first value.
> [_n-1] is Stata's way of referring to
> the previous value.
> 
> Now reinserting the panel aspect, you
> need to work
> 
> by firm:
> 
> but -by:- won't let you work with -in-.
> 
> gen K = k
> bysort firm (year) : replace K = 0.95 * K[_n-1] + I if _n > 1
> 
> should be closer to what you want.
> 
> If you -tsset-, the solution would be better as
> 
> tsset firm year
> gen K = k
> by firm: replace K = 0.95 * L.K + I if _n > 1
> 
> Nick
> [email protected]
> 
> Damiano Rossi
> 
> I need some help to compute a capital stock series from a gross 
> investment series. My primary problem is that I have to estimate the 
> initial capital stock (K_0 ) for each firm. As a general rule, it is 
> used the book value of fixed capital (K) in the first year of data
(e.g. 
> 1996) for each firm. How can I command Stata to consider this first 
> observation (firm by firm) and then compute a capital stock series, 
> using a perpetual inventory and a constant rate of depreciation? A 
> previous post doesn't help me much on this point. These are the data.
> 
> Panl oif 300 firms, 10 years (1996-2006)
> k = capital stock
> I = capital investment
> d [delta] = 0.05
> 
> The evolution of the real capital stock is:
> K_t+i = (1 - d)*K_t+i-1 + I_t+i

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index