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

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

From   n j cox <>
Subject   Re: st: How to generate a cumulative sum (capital stock)
Date   Thu, 25 Oct 2007 18:38:08 +0100

I don't see how anyone can comment on the previous
post mentioned so vaguely.

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


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:

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