Hi! I have a panel data with prices (p) item and time(t). I would like to compute the cumulative inflation. I.e.:
| t |
p |
item |
p/p[t-1] |
| 1 |
10 |
apple |
. |
| 2 |
12 |
apple |
1.2 |
| 3 |
10 |
apple |
0.833 |
| 4 |
15 |
apple |
1.5 |
| 1 |
20 |
orange |
. |
| 3 |
21 |
orange |
1.05 |
| 4 |
20 |
orange |
0.952 |
| 5 |
20 |
orange |
1 |
| 6 |
20 |
orange |
1 |
that implies for
apples the cumulative inflation was: 1.2 for t=2, 1 for t=3 and 1.5 for t=4 and for
oranges: 1.05 for t=3 and then 1 until the end of the period. How can I compute that with stata.
For the last column (the
monthly inflation) I have:
Code:
gen price_change_per = price/price[_n-1] if item==item[_n-1]
but I cannot come up with the doce for the cumulative one? I'm concerned not only for the final value of the cumulative inflation (1.5 for apples and 1 for oranges) but also for the evolution it has.
Best and thanks a lot!
0 Response to Cumulative inflation
Post a Comment