Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: generate the level series from the growth rate series


From   annoporci <[email protected]>
To   [email protected]
Subject   Re: st: generate the level series from the growth rate series
Date   Fri, 04 Jan 2013 14:32:30 +0800

And your initial values come from where?

I will take 100 as a starting value to create an index.

In the sp500 example, I used the value from the dataset so I could quickly check that my calculations were correct, hence:

  replace close2 = 1283.27 in 1

where 1283.27 is the value of "close[_n]" in the dataset.

Thanks.

--
Patrick Toche.


And your initial values come from where?

Nick

On Thu, Jan 3, 2013 at 11:50 PM, annoporci <[email protected]> wrote:
Dear Statalist,

This must be a very simple question...

I have data for percentage changes and would like to reconstruct the
levels of the variables.

Taking the sp500 dataset, I show below that I can generate the one-period difference series for the level variable "close", with and without tsset. Then I try to reverse-engineer to recover the level variable "close" from
the difference series named "change", but I get stuck.

sysuse sp500
gen change2 = close-close[_n-1] /// method without tsset

gen t=_n
tsset t
gen change3 = close-L.close /// method with tsset

gen close2 = .
replace close2 = 1283.27 in 1 /// assign the first value
replace close2 = close2[_n-1]+change /// try to recover the level

This last step fails.

I'd appreciate your help very much.

--
Patrick Toche.
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index