Dear community, I want to conduct Chow test for lagged time series for the following output variables: z1, z2, and z3.
But the code generates / invalid name r(198); error.
I wonder if anyone could help me to figure out the error in the following code or any simpler way to do the Chow test for lagged model.
My initial question was: is there still a simpler way of doing Chow test regardless of time series model specification or still should I run the test in the following way?
But the code generates / invalid name r(198); error.
I wonder if anyone could help me to figure out the error in the following code or any simpler way to do the Chow test for lagged model.
My initial question was: is there still a simpler way of doing Chow test regardless of time series model specification or still should I run the test in the following way?
Code:
use "cleaned.dta", clear
foreach yvar in ///
z1 ///
z2 ///
z3 ///
{
// Generate breakpoint indicator where t is a string time variable.
gen break = t < "`breakpoint'".
// Generate interaction terms
foreach lag in 1/2 {
gen breakX`lag' = break * L`lag'.`yvar'_diff
}
gen breakXdi_diff = break * di_diff
// Combined regression including interaction terms
di "------------------ Combined Regression for Chow Test ------------------"
reg `yvar'_diff L(1/2).`yvar'_diff L(0/1).di_diff breakX1 breakX2 breakXdi_diff
// Conduct Chow Test
test breakX1 breakX2 breakXdi_diff
// Store Chow test results to a text file
outreg2 using "$path_output/ChowTestResults_`yvar'.txt", replace
// Clear generated variables for the next iteration
drop break breakX1 breakX2 breakXdi_diff
}
