Dear Statalists,
I also posted this question on researchgate.net but just figured it might be better placed in a Stata-Forum since it is a Stata-specific question.
I have a cyclical time series y_t for two groups. By splitting the cycles into fixed phases I compare the average value per phase between those groups and thus try to compare the cycle pattern phase-wise. For this I introduce dummy variables per phase and regress on a constant to obtain the average over all cycles for each phase. I then perform Chow-Test (manually) as described in the Stata-FAQ to compare the estimated averages between both groups.
For the following example data (see bottom), I simplify all cycles to be of length of one year and split each cycle into 4 phases, so that we can use the quarters as phases.
I tried to apply the examples given in the Stata-FAQ and other Stata-links as linked in the Example-Code, yet the simplification to regression on a constant without further independent variables somehow leaves following questions open:
Cheers,
Jonathan
I also posted this question on researchgate.net but just figured it might be better placed in a Stata-Forum since it is a Stata-specific question.
I have a cyclical time series y_t for two groups. By splitting the cycles into fixed phases I compare the average value per phase between those groups and thus try to compare the cycle pattern phase-wise. For this I introduce dummy variables per phase and regress on a constant to obtain the average over all cycles for each phase. I then perform Chow-Test (manually) as described in the Stata-FAQ to compare the estimated averages between both groups.
For the following example data (see bottom), I simplify all cycles to be of length of one year and split each cycle into 4 phases, so that we can use the quarters as phases.
I tried to apply the examples given in the Stata-FAQ and other Stata-links as linked in the Example-Code, yet the simplification to regression on a constant without further independent variables somehow leaves following questions open:
- Do I need to regress each phase separately or can I pool them somehow together in Stata? The Stata-FAQ explains how to regress for both groups at the same time, but not on how this can be performed for multiple constants to regress on (in my case the phases).
- When regressing the constant term per phase, do I need to prune the panel to data only related to the phase being regressed or can I use the entire dataset per group (as implemented now)?
- How do I perform Chow-Test here using the command test instead of manually calculating the Chow-Test statistic?
Cheers,
Jonathan
Code:
* Generate Example Data * date: ranges from 0 to 11 - interpreted as Quarterly Dateformat this ranges from 1960q1 to 1962q4 * group: indicates what group (1 or 2) the data belongs to * value: imaginary data, which is identical for both groups for q1, q2 and q4 but (in average) slighty different for q3 input date group value * Group 1 0 1 1 1 1 0.5 2 1 -0.5 3 1 -1 4 1 1 5 1 0.5 6 1 -0.5 7 1 -1 8 1 1 9 1 0.5 10 1 -0.5 11 1 -1 * Group 2 0 2 1 1 2 0.5 2 2 -0.5 3 2 -1 4 2 1 5 2 0.5 6 2 -0.5 7 2 -1 8 2 1 9 2 0.5 10 2 -0.3 11 2 -1 end * Pre-Process Time format %tq date xtset group date gen quarter = quarter(dofq(date)) gen year = year(dofq(date)) * Analyse Example Data: * Phase 1, 2 and 4 are identical for all years and both groups * Phase 3 differs for Group 2 for the third year (1962), thus the average for phase 3 will differ as well line value quarter if group == 1 & year == 1960 || line value quarter if group == 2 & year == 1960, lpattern(dash) line value quarter if group == 1 & year == 1961 || line value quarter if group == 2 & year == 1961, lpattern(dash) line value quarter if group == 1 & year == 1962 || line value quarter if group == 2 & year == 1962, lpattern(dash) * Perform Chow-Test (for Quarter/Phase 3) * See: http://www.stata.com/support/faqs/statistics/computing-chow-statistic/ * Create Dummy Variable (See: http://stats.idre.ucla.edu/stata/faq/how-can-i-create-dummy-variables-in-stata/) tabulate quarter, generate(phase) * Run the separate regressions regress value phase3 if group==1, vce(robust) scalar ess_1 = e(rss) scalar N_1 = e(N) regress value phase3 if group==2, vce(robust) scalar ess_2 = e(rss) scalar N_2 = e(N) * Run the combined regression regress value phase3, vce(robust) scalar ess_c = e(rss) scalar k = 3 scalar F_chow_num = (ess_c -(ess_1+ess_2))/3 scalar F_chow_den = (ess_1+ess_2)/(N_1+N_2-2*k) scalar F_chow = F_chow_num / F_chow_den display F_chow
Comment