Dear all,
By following the method of Bry and Boschan (1971), full reference placed below, I want to identify Peaks and Troughs for my quarterly time series data-set. I want to identify peaks and troughs in the earnings data. I'd start by creating a dummy variable earnings_point which is 1 for a peak (local maximum) and -1 for a trough (local minimum)
I'd like to define a peak as a case where yt−2 ,yt-1< yt >yt+1,yt+2. Similarly, for a trough this would be the case where yt−2, yt−1, > yt < yt+1,yt+2.
In theory, I understand this, unfortunately I am not that experienced with Stata so I have no clue how to code this. If someone could help me, I would be very grateful.
I am also aware that there is a package available in Stata (sbbq), but I am interested in writing it as a code so I am able to understand better the process behind it and improve my knowledge of Stata. My data looks as follows:
yearQ deflated_seasonal_earnings
1947q1 8.743261
1947q2 8.92267
1947q3 8.990711
1947q4 9.064721
1948q1 9.124517
1948q2 9.198627
1948q3 9.39039
1948q4 9.590679
1949q1 9.667767
1949q2 9.713504
1949q3 9.758883
1949q4 9.680266
1950q1 9.902534
1950q2 10.07589
1950q3 10.0649
1950q4 10.25335
1951q1 10.16216
1951q2 10.30928
1951q3 10.42188
1951q4 10.46898
1952q1 10.59212
1952q2 10.67364
1952q3 10.67226
1952q4 10.96858
1953q1 11.17539
1953q2 11.29197
1953q3 11.38358
1953q4 11.40842
1954q1 11.37225
1954q2 11.4531
1954q3 11.41521
1954q4 11.49819
1955q1 11.6033
1955q2 11.71379
1955q3 11.87905
1955q4 11.87453
1956q1 11.84568
1956q2 12.01675
1956q3 11.99835
1956q4 12.23063
1957q1 12.19279
1957q2 12.15003
1957q3 12.22509
1957q4 12.3208
Thank you very much in advance!
Rajendra
Reference: Bry, Gerhard and Charlotte Boschan, 1971. Cyclical Analysis of Time Series: Procedures and Computer Programs, New York, NBER.
Related Posts with Identifying peaks and throughs
Collecting marginal effects after probit estimation with a series of dummy variablesHi Statalist, I'm attempting to estimate a probit model on the likelihood of a patent being accepte…
Creating Gini Coefficients from Categorical Income Data in 2000 US CensusHey everyone, This is my first post to Statalist. Please let me know if there is anything missing i…
Random Effect Ordered Logit BayesianHi, I am trying to estimate the group residuals (RE) of the following simple model: HTML Code: Y…
How to plot the below graphs after quantile regression?Please could anyone tell how to plots the same graphs after quantile regression? I have tried to plo…
xtabond2: Hansen testGood day all, I'm running a dynamic panel regression with results shown below. I'm wondering if my …
Subscribe to:
Post Comments (Atom)
0 Response to Identifying peaks and throughs
Post a Comment