Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

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

From |
Natasha Xingyuan Che <ilovewordsworth@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: RE: How to identify patterns of cyclicality using STATA? |

Date |
Mon, 7 Nov 2011 14:22:24 -0500 |

Hi Nick, That was very helpful. Thanks. But here is one additional complication in this specific example. The cycles are not always in symmetry, i.e., there are more peaks than troughs. For example, the two variables identifying peak and trough can look like this: peak trough 0 0 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 Now if I apply what you suggested: (gen period = sum(peak - trough)). The variable "period" would be equal to 1 for the spell between 1st and 2nd peak and the spell after the trough. But the recession is actually the spell between the 2nd peak and the trough, for which the variable "period" would be equal to 2. I think the bottom line is I need to identify only those peaks that are followed by a trough in some future date. Do you have any suggestions on how to do that? Many thanks! -Natasha On Mon, Nov 7, 2011 at 5:56 AM, Nick Cox <n.j.cox@durham.ac.uk> wrote: > Check out > > SJ-7-2 dm0029 . . . . . . . . . . . . . . Speaking Stata: Identifying spells > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . N. J. Cox > Q2/07 SJ 7(2):249--265 (no commands) > shows how to handle spells with complete control over > spell specification > > and -tsspell- (SSC) > > for some Stata technique in this area. > > Your first question appears to be answered, at least roughly, by > > bysort country (time) : gen period = sum(peak - trough) > tsspell , cond(period == 1) > > Nick > n.j.cox@durham.ac.uk > > Natasha Xingyuan Che > > I'm trying to identify business cycle peaks, troughs, and phases of > recession and recovery in a panel data set of countries's quarterly > output series. I identified peaks and troughs, but am having trouble > marking the periods in between (i.e., recessions and recoveries). I > would really appreciate it if any of you have suggestions about how to > do this. > > The specific definitions of the variables are the following -- > > A peak occurs at Quarter t of a time series of Y_t if: > (Y_t - Y_t-1) > 0 and (Y_t - Y_t-2) > 0 and (Y_t - Y_t+1) > 0 and (Y_t > - Y_t+2) > 0 > > A trough occurs at Quarter t if: > (Y_t - Y_t-1) < 0 and (Y_t - Y_t-2) < 0 and (Y_t - Y_t+1) < 0 and (Y_t > - Y_t+2) < 0 > > A "recession" is a phase from peak to the next trough. A "recovery" > is a phase from trough to the quarter when Y reaches the level of the > previous peak. > > I generated two 0/1 variables, peak and trough, as the following -- > > tsset country time > gen peak=(lny>l.lny&lny>l2.lny&lny>f.lny&lny>f2.lny) > gen trough=(lny<l.lny&lny<l2.lny&lny<f.lny&lny<f2.lny) > > Now I want to generate two variables marking the quarters when the > economy is in recession and in recovery and calculate the respective > duration of the two. But I'm not sure how to proceed. Again, all > your inputs are very much appreciated. Thank you so much for your > help! > > * > * For searches and help try: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/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/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**RE: st: RE: How to identify patterns of cyclicality using STATA?***From:*Nick Cox <n.j.cox@durham.ac.uk>

**References**:**st: How to identify patterns of cyclicality using STATA?***From:*Natasha Xingyuan Che <ilovewordsworth@gmail.com>

**st: RE: How to identify patterns of cyclicality using STATA?***From:*Nick Cox <n.j.cox@durham.ac.uk>

- Prev by Date:
**st: RE: relevance of the instruments** - Next by Date:
**st: Numbers with decimals and -float- command** - Previous by thread:
**st: RE: How to identify patterns of cyclicality using STATA?** - Next by thread:
**RE: st: RE: How to identify patterns of cyclicality using STATA?** - Index(es):