*
* Enders, Applied Econometric Time Series, 4th edition
* Example from Section 7.12, pp 472-3
* Structural breaks
*
all 250
open lstarbreak.xls
data(format=xls,org=obs,verb)
*
* The series was generated with the following:
*
*seed 2003
*set eps = %ran(1)
*set theta = 1/(1+exp(-.075*(t-100.)))
*set(first=2.) y = 1 + 3*theta + 0.5*y{1} + eps
*
@baiperron(minspan=8,maxbreaks=4,tests,nfix=1) y
# y{1} constant
*
* Compute the means of the BP chosen subsamples
*
dec vect[series] dummies(4)
do i=1,4
set dummies(i) = t<=%%breakpoints(i)
end do i
*
linreg y
# constant dummies
*
prj bpfitted
*
* LSTAR model (only the intercept changes)
*
nonlin(parmset=regparms) a0 a1 b0
nonlin(parmset=starparms) gamma c
*
frml lstar y = a0 + a1*y{1} + b0/(1+exp(-gamma*(t-c)))
*
* Since the threshold variable is time, an obvious "blind" guess would
* be a break point halfway through the data. A gamma of 10/T will give a
* fairly smooth transition function.
*
* An obvious alternative would be to do something like @APBreakTest or
* @ThreshTest to find the biggest break in the model and use that.
*
compute c=250/2.
compute gamma=10.0/250
*
nlls(frml=lstar,parmset=regparms)
nlls(frml=lstar,parmset=regparms+starparms)
*
* Mean of the process. This uses the deterministic part for the
* intercept, and converts to the process mean by dividing by 1-AR
* coefficient.
*
set lstarfitted = (a0 + b0/(1+exp(-gamma*(t-c))))/(1-a1)
*
spgraph(hfields=2,header="Figure 7.15 A Simulated LSTAR Break")
graph(noaxis,key=below,nokbox,header="Panel a: Bai-Perron Breaks") 2
# fitted
# bpfitted / 2
graph(noaxis,key=below,nokbox,header="Panel b: Logistic Break") 2
# fitted_2
# lstarfitted / 2
spgraph(done)