THRESHTEST - Regression with threshold breaks
Attached is a revised version of the THRESHTEST procedure for testing for a threshold break in a linear regression, assuming homoscedatic errors. The newer version creates or sets several additional variables, such as %%BREAKVALUE as the optimal break.
@ThreshTest( options ) depvar start end
# list of explanatory variables
Options
THRESH=threshold series. If omitted, time is used. If this involves a lag, you need to create it as a separate series.
TRIM=fraction of values to skip at both ends [.15]
NREPS=number of bootstrap replications [0]
If you provide a positive value, this computes an approximate significance level by bootstrapping with random Normal draws.
SMPL=SMPL series for entries to skip
TITLE=title for report ["Test of Threshold Effect"]
[PRINT]/NOPRINT
GRAPH/[NOGRAPH]
If chosen, graphs the F-tests against the threshold values
Variables Defined
Example
@ThreshTest( options ) depvar start end
# list of explanatory variables
Options
THRESH=threshold series. If omitted, time is used. If this involves a lag, you need to create it as a separate series.
TRIM=fraction of values to skip at both ends [.15]
NREPS=number of bootstrap replications [0]
If you provide a positive value, this computes an approximate significance level by bootstrapping with random Normal draws.
SMPL=SMPL series for entries to skip
TITLE=title for report ["Test of Threshold Effect"]
[PRINT]/NOPRINT
GRAPH/[NOGRAPH]
If chosen, graphs the F-tests against the threshold values
Variables Defined
| %CDSTAT | Maximum test statistic |
| %SIGNIF | Bootstrapped p-value |
| %RSS | Minimal sum of squared residuals |
| %LOGL | Maximal log likelihood |
| %%BREAKVALUE | Threshold value at the optimal break |
Example
- Code: Select all
*
* Enders, Applied Econometric Time Series, 3rd edition
* Example from Section 7.6, pp 451-454
* Threshold model for unemployment
*
open data unrate_decimal.xls
calendar(m) 1960:1
data(format=xls,org=columns) 1960:01 2008:12 unrate
*
graph(footer="U.S. Unemployment Rate")
# unrate 1960:1 2008:12
*
set dur = unrate-unrate{1}
linreg dur / e
# constant dur{1 to 4 12}
@regcorrs(number=10)
@regreset(h=4)
@mcleodli(number=2) e
*
set esq = e^2
linreg e
# constant esq{1}
*
set dulagged = dur{1}
*
* Note that this graphs the F statistics, which will be reversed
* vertically from the graph for the sum of squared residuals (that is,
* the break is indicated by the highest value, not lowest).
*
@threshtest(threshold=dulagged,graph) dur
# constant dur{1 to 4 12}
disp "Sum of Squared Residuals" %rss
*
* Trying other delays
*
set dulagged2 = dur{2}
set dulagged3 = dur{3}
*
@threshtest(threshold=dulagged2) dur
# constant dur{1 to 4 12}
disp "Sum of Squared Residuals" %rss
@threshtest(threshold=dulagged3) dur
# constant dur{1 to 4 12}
disp "Sum of Squared Residuals" %rss
*
* Redo the estimates with the chosen delay
*
@threshtest(threshold=dulagged) dur
# constant dur{1 to 4 12}
*
* Estimate the two branches of the model.
*
linreg(smpl=dulagged>%%breakvalue) dur
# constant dur{1 to 4 12}
linreg(smpl=dulagged<=%%breakvalue) dur
# constant dur{1 to 4 12}