Title: | Estimation and Inference for Structural Breaks in Linear Regression Models |
---|---|
Description: | Functions provide comprehensive treatments for estimating, inferring, testing and model selecting in linear regression models with structural breaks. The tests, estimation methods, inference and information criteria implemented are discussed in Bai and Perron (1998) "Estimating and Testing Linear Models with Multiple Structural Changes" <doi:10.2307/2998540>. |
Authors: | Linh Nguyen [aut, cre], Yohei Yamamoto [aut], Pierre Perron [aut] |
Maintainer: | Linh Nguyen <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.0.1 |
Built: | 2025-03-11 05:47:29 UTC |
Source: | https://github.com/rodivinity/mbreaks |
compile_model()
compiles the information of model
class object x
into three
main tables:
Table for estimated break date in the model
with 90% and 95% confidence intervals based on robust
,hetomega
, hetq
options
for errors and prewhit
option.
Table for estimated coefficients for z
regressors
with corrected standard errors based on robust
,hetdat
,hetvar
options for errors and prewhit
option.
Table for estimated coefficients for x
regressors
with corrected standard errors based on robust
, hetdat
, and hetvar
options for errors and prewhit
option.
compile_model(x, digits = 3)
compile_model(x, digits = 3)
x |
the |
digits |
number of digits displayed in console. Default value is 3 |
Formatted x
with the following appended tables:
A data frame storing the break date estimated by the model, and their corresponding confidence intervals.
A data frame storing the estimated coefficients which allowed to change across regimes with corrected standard errors.
A data frame storing the estimated coefficients which is constant across regimes with corrected standard errors.
If x
returns 0 number of estimated break,
the function will return NULL
value instead of the list in Value
.
If x
is a pure structural break, the 'FS_tab' will return NULL
in
Value
.
'compile_sbtests' formats the output of 'sbtests' into two tables.
compile_sbtests(x, digits = 3)
compile_sbtests(x, digits = 3)
x |
An 'sbtests' class object. |
digits |
The number of decimal places displayed. |
A modified 'sbtests' object, 'x', with two appended data frames:
A data frame containing SupF test statistics for testing 0 versus m breaks, where m is the maximum number of breaks considered in 'x'. It includes critical values at the 10%, 5%, 2.5%, and 1% levels.
A data frame containing Double Max test statistics with critical values at the 10%, 5%, 2.5%, and 1% levels.
'compile_seqtests' formats the output of the 'seqtests' class object to 1 table
A table containing sequential sup F tests statistics of 'l' versus 'l+1' for 'l' in '1' to 'm' breaks with critical values of the corresponding tests at 1%, 2.5%, 5%, and 10% significance levels.
compile_seqtests(x)
compile_seqtests(x)
x |
'seqtests' class object |
class 'seqtests' list 'x' with appended data frame 'sfl' containing the sequential SupF test statistics with critical values at 10%, 5%, 2.5%, and 1% level.
'hac()' corrects the estimated errors based on options of prewhitening using a AR(1) process estimation of error terms to obtain heteroskedasticy and autocorrelation consistency (HAC) errors with automatic bandwith and kernel similar to Andrews, 1994
correct(reg, res, prewhit)
correct(reg, res, prewhit)
reg |
matrix of regressors |
res |
matrix of estimated residuals |
prewhit |
Option of using prewhitening process. If |
hac Heteroskedasticy and autocorrelation consistent errors
Function calculates the critical values for break date
cvg(eta, phi1s, phi2s)
cvg(eta, phi1s, phi2s)
cvec Critical values of break dates
'dating()' computes break points that globally minimizes SSR via dynamic programming approach. To avoid recursion depth increases as number of breaks in the model increases, a temporary array is used to store optimal partition with corresponding SSR for all permissible subsamples for all 1:m-1 breaks. For the m-th break, the problem becomes finding where to insert the last feasible m+1-th segment into the sample partitioned by m-1 breaks to obtain minimum SSR over the sample
dating(y, z, h, m, q, bigT)
dating(y, z, h, m, q, bigT)
y |
matrix of dependent variable |
z |
matrix of regressors with coefficients allowed to change across regimes |
h |
minimum length of segment |
m |
maximum number of breaks |
q |
number of 'z' regressors |
bigT |
sample period T |
A list containing the following components:
glb |
minimum global SSR |
datevec |
Vector of dates (optimal minimizers) |
bigvec |
Associated SSRs |
'diag_par()' partition the matrix of 'z' regressors which coefficients are changed based on the provided break dates
diag_par(input, m, date)
diag_par(input, m, date)
input |
matrix of independent variables z with coefficients allowed to change overtime |
m |
number of breaks in the series |
date |
vector of break dates |
output: matrix of partitioned variables corresponds to break dates
z = matrix(c(1:100),50,2) m = 2 #2 breaks date = matrix(c(15,30),2,1) #first break at t = 15; second break at t = 30 diag_par(z,m,date)
z = matrix(c(1:100),50,2) m = 2 #2 breaks date = matrix(c(15,30),2,1) #first break at t = 15; second break at t = 30 diag_par(z,m,date)
'dofix()' compute a structural change model with pre-specified number of breaks.
dofix( y_name, z_name = NULL, x_name = NULL, data, fixn = 5, eps = 1e-05, eps1 = 0.15, maxi = 10, fixb = 0, betaini = 0, printd = 0, prewhit = 1, robust = 1, hetdat = 1, hetvar = 1, hetq = 1, hetomega = 1, const = 1, h = NULL )
dofix( y_name, z_name = NULL, x_name = NULL, data, fixn = 5, eps = 1e-05, eps1 = 0.15, maxi = 10, fixb = 0, betaini = 0, printd = 0, prewhit = 1, robust = 1, hetdat = 1, hetvar = 1, hetq = 1, hetomega = 1, const = 1, h = NULL )
y_name |
name of dependent variable in the data set |
z_name |
name of independent variables in the data set which coefficients are allowed to change
across regimes. |
x_name |
name of independent variables in the data set which coefficients are constant across
regimes. |
data |
name of data set used |
fixn |
number of breaks specified |
eps |
convergence criterion for iterative recursive computation |
eps1 |
value of trimming (in percentage) for the construction
and critical values. Minimal segment length 'h' will be set
at
|
maxi |
maximum number of iterations |
fixb |
option to use fixed initial input |
betaini |
Initial |
printd |
Print option for model estimation. |
prewhit |
set to |
robust |
set to |
hetdat |
option for the construction of the F tests. Set to 1 if want to
allow different moment matrices of the regressors across segments.
If |
hetvar |
option for the construction of the F tests.Set to |
hetq |
used in the construction of the confidence intervals for the break
dates. If |
hetomega |
used in the construction of the confidence intervals for the break
dates. If |
const |
indicates whether the regression model include an intercept changing across regimes. Default value is 1 |
h |
Minimum segment length of regime considered in estimation. If users want to specify a particular value, please set 'eps1=0' |
out A list of class 'model' contains all information about the estimated structural change model with 'fixn' breaks
dofix('rate',data=real,fixn=3)
dofix('rate',data=real,fixn=3)
'doglob()' identify if the structural change model is i) pure or ii)
partial change model. The procedure then calls appropriate functions dating
to estimate
the pure change model and nldat
to estimate the partial change model.
doglob(y, z, x, m, eps, h, maxi, fixb, betaini, printd, eps1)
doglob(y, z, x, m, eps, h, maxi, fixb, betaini, printd, eps1)
y |
matrix of dependent variable |
z |
matrix of independent variables with coefficients allowed to change across regimes |
x |
matrix of independent variables with coefficients constant across regimes |
m |
number of breaks in the structural change model |
eps |
convergence criterion for iterative recursive computation. (For partial change model ONLY) |
h |
Minimum segment length of regime considered in estimation. If users want to specify a particular value, please set 'eps1=0' |
maxi |
maximum number of iterations. (For partial change model ONLY) |
fixb |
option to use fixed initial input |
betaini |
Initial |
printd |
Print option for model estimation. |
eps1 |
trimming level |
A list containing the following components:
Minimum global SSR.
Vector of dates (optimal minimizers).
Associated SSRs with possible break dates combination.
'doorder()' estimates the number of breaks using one of the following information criteria:
modified Bayesian information criterion by Kurozumi and Tuvaandorj, 2011,
modified Schwarz information criterion by Liu, Wu and Zidek, 1997,
Bayesian information criterion by Yao, 1988
and the structural break model corresponding to estimated number of breaks.
doorder( y_name, z_name = NULL, x_name = NULL, data, m = 5, eps = 1e-05, eps1 = 0.15, maxi = 10, fixb = 0, betaini = 0, printd = 0, ic = "KT", const = 1, h = NULL, prewhit = 1, hetdat = 1, hetq = 1, hetomega = 1, hetvar = 1, robust = 1 )
doorder( y_name, z_name = NULL, x_name = NULL, data, m = 5, eps = 1e-05, eps1 = 0.15, maxi = 10, fixb = 0, betaini = 0, printd = 0, ic = "KT", const = 1, h = NULL, prewhit = 1, hetdat = 1, hetq = 1, hetomega = 1, hetvar = 1, robust = 1 )
y_name |
name of dependent variable in the data set |
z_name |
name of independent variables in the data set which coefficients are allowed to change
across regimes. |
x_name |
name of independent variables in the data set which coefficients are constant across
regimes. |
data |
name of data set used |
m |
maximum number of breaks |
eps |
convergence criterion for iterative recursive computation |
eps1 |
value of trimming (in percentage) for the construction
and critical values. Minimal segment length 'h' will be set
at
|
maxi |
maximum number of iterations |
fixb |
option to use fixed initial input |
betaini |
Initial |
printd |
Print option for model estimation. |
ic |
indicator which information criterion is used in selecting number of breaks:
The default value is |
const |
indicates whether the regression model include an intercept changing across regimes. Default value is 1 |
h |
Minimum segment length of regime considered in estimation. If users want to specify a particular value, please set 'eps1=0' |
prewhit |
set to |
hetdat |
option for the construction of the F tests. Set to 1 if want to
allow different moment matrices of the regressors across segments.
If |
hetq |
used in the construction of the confidence intervals for the break
dates. If |
hetomega |
used in the construction of the confidence intervals for the break
dates. If |
hetvar |
option for the construction of the F tests.Set to |
robust |
set to |
A list of class 'model' that contains one of the following:
change model with number of breaks selected by BIC
change model with number of breaks selected by LWZ
change model with number of breaks selected by KT
Liu J, Wu S, Zidek JV (1997). "On Segmented Multivariate Regressions", Statistica Sinica, 7, 497-525. Yao YC (1988). "Estimating the Number of Change-points via Schwartz Criterion", Statistics and Probability Letters, 6, 181-189. Kurozumi E, Tuvaandorj P (2011). "Model Selection Criteria in Multivariate Models with Multiple Structural Changes", Journal of Econometrics 164, 218-238.
doorder('rate',data=real,ic=c('BIC'))
doorder('rate',data=real,ic=c('BIC'))
'dorepart()' computes the repartition estimates of the breaks obtained by the sequential method by Bai, 1995. It allows estimates that have the same asymptotic distribution as those obtained by global minimization. Otherwise, the output from the procedure "estim" below does not deliver asymptotically correct confidence intervals for the break dates.
dorepart( y_name, z_name = NULL, x_name = NULL, data, m = 5, eps = 1e-05, eps1 = 0.15, maxi = 10, fixb = 0, betaini = 0, printd = 0, prewhit = 1, robust = 1, hetdat = 1, hetvar = 1, const = 1, signif = 2 )
dorepart( y_name, z_name = NULL, x_name = NULL, data, m = 5, eps = 1e-05, eps1 = 0.15, maxi = 10, fixb = 0, betaini = 0, printd = 0, prewhit = 1, robust = 1, hetdat = 1, hetvar = 1, const = 1, signif = 2 )
y_name |
name of dependent variable in the data set |
z_name |
name of independent variables in the data set, whose coefficients are allowed to change
across regimes. |
x_name |
name of independent variables in the data set whose coefficients are constant across
regimes. |
data |
name of the data set used |
m |
Maximum number of structural changes allowed. If not specified,
|
eps |
convergence criterion for iterative recursive computation |
eps1 |
value of trimming (in percentage) for the construction
and critical values. Minimal segment length
|
maxi |
maximum number of iterations |
fixb |
option to use fixed initial input |
betaini |
Initial |
printd |
Print option for model estimation. |
prewhit |
set to |
robust |
set to |
hetdat |
option for the construction of the F tests. Set to 1 if you want to
allow different moment matrices of the regressors across segments.
If |
hetvar |
option for the construction of the F tests. Set to |
const |
indicates whether the regression model includes an intercept changing across regimes. Default value is 1 |
signif |
significance level used to sequential test to select number of breaks.
|
A list of class model
for the structural break model estimated by
the repartition procedure.
Bai, J. 1995, "Estimating Breaks One at a Time", Econometric Theory, 13, 315-352
dorepart('inf', 'inflag', 'inffut', data = nkpc)
dorepart('inf', 'inflag', 'inffut', data = nkpc)
'doseqtests()' computes the sequential sup F tests of l versus l+1 for l from 1 to m with each corresponding null hypothesis of maximum number of break is l and alternative hypothesis is l+1. The l breaks under the null hypothesis are taken from the global minimization estimation
doseqtests( y_name, z_name = NULL, x_name = NULL, data, m = 5, eps = 1e-05, eps1 = 0.15, maxi = 10, fixb = 0, betaini = 0, printd = 0, prewhit = 1, robust = 1, hetdat = 1, hetvar = 1, hetq = 1, hetomega = 1, const = 1 )
doseqtests( y_name, z_name = NULL, x_name = NULL, data, m = 5, eps = 1e-05, eps1 = 0.15, maxi = 10, fixb = 0, betaini = 0, printd = 0, prewhit = 1, robust = 1, hetdat = 1, hetvar = 1, hetq = 1, hetomega = 1, const = 1 )
y_name |
name of dependent variable in the data set |
z_name |
name of independent variables in the data set which coefficients are allowed to change
across regimes. |
x_name |
name of independent variables in the data set which coefficients are constant across
regimes. |
data |
name of data set used |
m |
maximum number of breaks |
eps |
convergence criterion for recursive calculations (For partial change model ONLY) |
eps1 |
value of trimming (in percentage) for the construction
and critical values. Minimal segment length 'h' will be set
at
|
maxi |
number of maximum iterations for recursive calculations of finding
global minimizers. |
fixb |
option to use fixed initial input |
betaini |
Initial |
printd |
Print option for model estimation. |
prewhit |
set to |
robust |
set to |
hetdat |
option for the construction of the F tests. Set to 1 if want to
allow different moment matrices of the regressors across segments.
If |
hetvar |
option for the construction of the F tests.Set to |
hetq |
used in the construction of the confidence intervals for the break
dates. If |
hetomega |
used in the construction of the confidence intervals for the break
dates. If |
const |
indicates whether the regression model include an intercept changing across regimes. Default value is 1 |
A list that contains following:
SupF(l+1|l) test statistics.
Critical values for SupF(l+1|l) test.
doseqtests('inf',c('inflag','lbs','inffut'),data=nkpc,prewhit=0)
doseqtests('inf',c('inflag','lbs','inffut'),data=nkpc,prewhit=0)
'dosequa()' sequentially increases the number of breaks from '1' to 'm' until the sequential tests reject and estimate the structural change model with corresponding estimated breaks. The procedure is proposed by Bai and Perron, 1998.
dosequa( y_name, z_name = NULL, x_name = NULL, data, m = 5, eps = 1e-05, eps1 = 0.15, maxi = 10, fixb = 0, betaini = 0, printd = 0, prewhit = 1, robust = 1, hetdat = 1, hetvar = 1, hetq = 1, hetomega = 1, const = 1, signif = 2 )
dosequa( y_name, z_name = NULL, x_name = NULL, data, m = 5, eps = 1e-05, eps1 = 0.15, maxi = 10, fixb = 0, betaini = 0, printd = 0, prewhit = 1, robust = 1, hetdat = 1, hetvar = 1, hetq = 1, hetomega = 1, const = 1, signif = 2 )
y_name |
name of dependent variable in the data set |
z_name |
name of independent variables in the data set, which coefficients are allowed to change across regimes. Default value is vector of 1 (Mean-shift model). |
x_name |
name of independent variables in the data set, which coefficients are constant across
regimes. Default value is |
data |
name of the data set used |
m |
maximum number of breaks |
eps |
convergence criterion for iterative recursive computation |
eps1 |
value of trimming (in percentage) for the construction
and critical values. Minimal segment length 'h' will be set
at default value =
|
maxi |
maximum number of iterations |
fixb |
option to use fixed initial input |
betaini |
Initial |
printd |
Print option for model estimation. |
prewhit |
set to |
robust |
set to |
hetdat |
option for the construction of the F tests. Set to 1 if you want to
allow different moment matrices of the regressors across segments.
If |
hetvar |
option for the construction of the F tests. Set to |
hetq |
used in the construction of the confidence intervals for the break
dates. If |
hetomega |
used in the construction of the confidence intervals for the break
dates. If |
const |
indicates whether the regression model includes an intercept changing across regimes. Default value is 1 |
signif |
significance level used in the sequential test to select number of breaks.
|
A list of 'model' class with the number of breaks selected by sequential tests.
dosequa('rate', data = real, signif = 1)
dosequa('rate', data = real, signif = 1)
'dotest()' compute the test statistics and report the critical values of the 2 main supF tests below:
SupF test of 0 vs m breaks
Double Max test proposed by Perron and Bai, 1998
dotest( y_name, z_name = NULL, x_name = NULL, data, m = 5, eps = 1e-05, eps1 = 0.15, maxi = 10, fixb = 0, betaini = 0, printd = 0, prewhit = 1, robust = 1, hetdat = 1, hetvar = 1, hetq = 1, hetomega = 1, const = 1 )
dotest( y_name, z_name = NULL, x_name = NULL, data, m = 5, eps = 1e-05, eps1 = 0.15, maxi = 10, fixb = 0, betaini = 0, printd = 0, prewhit = 1, robust = 1, hetdat = 1, hetvar = 1, hetq = 1, hetomega = 1, const = 1 )
y_name |
matrix of dependent variable |
z_name |
matrix of regressors which coefficients are allowed to change across regimes. |
x_name |
matrix of regressors which coefficients are constant across regimes. |
data |
the data set for estimation |
m |
maximum number of breaks |
eps |
convergence criterion for iterative recursive computation |
eps1 |
trimming level |
maxi |
maximum number of iterations |
fixb |
option to use fixed initial input |
betaini |
Initial |
printd |
Print option for model estimation. |
prewhit |
option to use AR(1) for prewhitening |
robust |
set to |
hetdat |
option for the construction of the F tests. Set to 1 if want to
allow different moment matrices of the regressors across segments.
If |
hetvar |
option for the construction of the F tests.Set to |
hetq |
used in the construction of the confidence intervals for the break
dates. If |
hetomega |
used in the construction of the confidence intervals for the break
dates. If |
const |
indicates whether the regression model include an intercept changing across regimes. Default value is 1 |
A list that contains following:
SupF test of 0 vs m (1 to maximum) breaks statistics
Critical values for Sup F test
Critical values for Double Max test
table summarizing the SupF test (for viewing purposes)
table summarizing the Double Max test (including UDMax statistics and CVs)
'estim()' estimates the structural change model by OLS given specified vector of break dates It also computes and reports confidence intervals for the break dates based on asymptotic distributions of break date and corrected standard errors of coefficients estimates given the structure of covariance matrix for model errors by specifying error options 'robust', 'hetomega', 'hetq', 'hetdat' and 'hetvar'
estim(m, q, z, y, b, robust, prewhit, hetomega, hetq, x, p, hetdat, hetvar)
estim(m, q, z, y, b, robust, prewhit, hetomega, hetq, x, p, hetdat, hetvar)
m |
number of breaks |
q |
number of 'z' regressors z |
z |
matrix of regressors with coefficients are allowed to change across regimes |
y |
matrix of dependent variable |
b |
vector of break dates |
robust , hetomega , hetq , hetdat , hetvar
|
options for assumptions on the error terms.
For more details, please refer to |
prewhit |
option to use prewhitening process based on AR(1) approximation |
x |
matrix of regressors with coefficients are constant across regimes |
p |
number of regressors x |
A list containing the following components:
List of estimated breaks.
List of Confidence Intervals for each corresponding break.
Estimated coefficients of the regression. The first
(m
+1)*q
are coefficients of q
variables z
that change across regimes.
The last p
are coefficients of p
variables x
that are constant across regimes.
Corrected standard errors for the coefficients' estimates
Function computes the p-value of the test
funcg(x, bet, alph, b, deld, gam)
funcg(x, bet, alph, b, deld, gam)
g The p-value
Function to retrieve critical values of supF test stored in
/SysData/SupF/cv_x.csv where x
corresponds to the trimming level:
1: eps1
= 5%
2: eps1
= 10%
3: eps1
= 15%
4: eps1
= 20%
5: eps1
= 25%
The critical values are tabulated from @references
getcv1(signif, eps1)
getcv1(signif, eps1)
signif |
significant level |
eps1 |
trimming level |
cv Critical value of SupF test
Function to retrieve critical values of SupF(l+1|l) test stored in
/SysData/SupF_next/cv_x.csv where x
corresponds to the trimming level:
1: eps1
= 5%
2: eps1
= 10%
3: eps1
= 15%
4: eps1
= 20%
5: eps1
= 25%
The critical values are tabulated from @references
getcv2(signif, eps1)
getcv2(signif, eps1)
signif |
significant level |
eps1 |
trimming level |
cv Critical value of SupF(l+1|l) test
'interval()' computes confidence intervals for the break dates based on approximating the limiting distribution of the break date following the "shrinking shifts" asymptotic framework
interval(y, z, zbar, b, q, m, robust, prewhit, hetomega, hetq, x, p)
interval(y, z, zbar, b, q, m, robust, prewhit, hetomega, hetq, x, p)
y |
matrix of dependent variable |
z |
matrix of independent variables with coefficients allowed to change across regimes |
zbar |
partitioned matrix of independent variables with coefficients allowed to change across regimes according to break date vector 'b' |
b |
vector of break breaks |
q |
number of 'z' regressors |
m |
maximum number of breaks |
robust |
set to |
prewhit |
Option of using prewhitening process. If |
hetomega , hetq
|
options for assumptions of error terms structure. For more details, refers to [mdl()] |
x |
matrix of independent variables with coefficients constant across regimes |
p |
number of 'x' regressors |
bound Confidence intervals of break date in 90%
and 95%
significant level
The procedure to compute the long run covariance matrix jhat
based
on variance matrix vmat
jhatpr(vmat)
jhatpr(vmat)
vmat |
variance matrix |
jhat Long run covariance matrix
'mdl()' calls main functions of the 'mbreaks' package to execute the following estimation procedures:
Function dotest
conducts Sup F tests of '0' versus 'm' breaks and Double Max tests.
Function doseqtests
conducts the sequential Sup F tests of 'l' versus 'l+1' breaks.
Function doorder
conducts the number of breaks selection from '1' to 'm'
breaks using the following information critera: KT
,BIC
, and LWZ
.
Function dosequa
conducts the number of breaks selection by sequential tests
from '1' to 'm' breaks using sequential Sup F tests.
Function dofix
conducts structural break model estimation with 'fixn' breaks.
All the procedures automatically identify if the 'model' is either i) pure structural breaks model or ii) partial structural breaks model
mdl( y_name, z_name = NULL, x_name = NULL, data, eps1 = 0.15, m = 5, prewhit = 1, robust = 1, hetdat = 1, hetvar = 1, hetomega = 1, hetq = 1, maxi = 10, eps = 1e-05, fixn = -1, fixb = 0, betaini = 0, printd = 0, const = 1, signif = 2, h = NULL )
mdl( y_name, z_name = NULL, x_name = NULL, data, eps1 = 0.15, m = 5, prewhit = 1, robust = 1, hetdat = 1, hetvar = 1, hetomega = 1, hetq = 1, maxi = 10, eps = 1e-05, fixn = -1, fixb = 0, betaini = 0, printd = 0, const = 1, signif = 2, h = NULL )
y_name |
name of dependent variable in the data set. |
z_name |
name of independent variables in the data set which coefficients are allowed to change
across regimes. |
x_name |
name of independent variables in the data set which coefficients are constant across
regimes. |
data |
the data set for estimation. |
eps1 |
value of trimming (in percentage) for the construction
and critical values. Minimal segment length 'h' will be set
at
The default value is set at |
m |
Maximum number of structural changes allowed. If not specify,
m will be set to |
prewhit |
set to |
robust |
set to |
hetdat |
option for the construction of the F tests. Set to 1 if want to
allow different moment matrices of the regressors across segments.
If |
hetvar |
option for the construction of the F tests.Set to |
hetomega |
used in the construction of the confidence intervals for the break
dates. If |
hetq |
used in the construction of the confidence intervals for the break
dates. If |
maxi |
number of maximum iterations for recursive calculations of finding
global minimizers. |
eps |
convergence criterion for recursive calculations (For partial change model ONLY) |
fixn |
number of pre-specified breaks. |
fixb |
option to use fixed initial input |
betaini |
Initial |
printd |
Print option for model estimation. |
const |
indicates whether the regression model include an intercept changing across regimes. Default value is 1. |
signif |
significance level used to sequential test to select number of breaks.
|
h |
Minimum segment length of regime considered in estimation. If users want to specify a particular value, please set 'eps1=0' |
A list that contains the following:
A list of class 'sbtests' representing Sup F tests of 0 versus m breaks and Double Max tests.
A list of class 'seqtests' representing sequential Sup F test of l versus l+1 breaks.
A list of class 'model' with structural break model estimated by number of breaks by BIC
criterion.
A list of class 'model' with structural break model estimated by number of breaks by LWZ
criterion.
A class 'model' with structural break model estimated by number of breaks by KT
criterion.
A class 'model' with structural break model estimated by number of breaks by sequential tests.
A class 'model' with structural break model estimated by pre-specified 'fixn' number of breaks.
Note: All default
values of error assumptions (robust
,
hetdat
, hetvar
, hetq
) are set to 1. The implications on
the structure of model\'s errors related to individual settings are explained within
the arguments section for each option.
dotest
, doseqtests
, doorder
, dosequa
, and dofix
which are functions called by 'mdl()'.
US_rate = mdl('rate',data=real) nkpc_lbs = mdl('inf',c('inflag','lbs','inffut'),data=nkpc,prewhit = 0)
US_rate = mdl('rate',data=real) nkpc_lbs = mdl('inf',c('inflag','lbs','inffut'),data=nkpc,prewhit = 0)
Function to calculate power of a matrix @noRd
mpower(A, t)
mpower(A, t)
Data set from inflation and other macroeconomic variables
nkpc
nkpc
## 'nkpc' A data frame with 151 rows and 12 columns:
Current period year
Quarter in current period year
Inflation rate
Inflation rate in previous period
Expected inflation rate, taken as value of inflation rate of next period
Productivity output gap
Perron, P. and Yamamoto, Y., 2015. "Using ols to estimate and test for structural changes in models with endogenous regressors." Journal of Applied Econometrics 30, 119–144.
'nldat()' computes the break dates of a partial structural change model for a pre-specified number of breaks 'm'. The procedure iterates between estimating the invariant and changing coefficients of 'x' and 'z' regressors until convergence, by noting that the residuals from linear regression model between 'y' and 'x' regressors is a pure structural change model, while the residuals from pure structural change model between 'y' and 'z' regressors is a linear regression
nldat(y, z, x, h, m, p, q, bigT, fixb, eps, maxi, betaini, printd)
nldat(y, z, x, h, m, p, q, bigT, fixb, eps, maxi, betaini, printd)
y |
dependent variable in matrix form |
z |
matrix of regressors which coefficients are allowed to change across regimes |
x |
matrix of regressors which coefficients are constant across regime |
h |
minimum segment length |
m |
number of breaks |
p |
number of 'z' regressors |
q |
number of 'x' regressors |
bigT |
the sample size T |
fixb |
option to use initial |
eps |
Convergence criterion (For partial change model ONLY) |
maxi |
Maximum number of iterations (For partial change model ONLY) |
betaini |
initial beta values. Required when use with option |
printd |
option to print output from iterated estimations. If |
A list containing the following components:
glb |
minimum global SSR |
datevec |
Vector of dates (optimal minimizers) |
bigvec |
Associated SSRs |
Bai J, Perron P (1998). "Estimating and Testing Linear Models with Multiple Structural Changes" Econometrica, 66, 47-78. Bai J, Perron P (2003). "Computation and Analysis of Multiple Structural Change Models" Journal of Applied Econometrics 18, 1-22
Function computes the optimal one break partition in partial structural change model by searching over all possible breaks given x regressors have unchanged coefficients. Iteration to convergence is used to deal with 2 sets of estimates needed to obtain: full-sample coefficients and regime-specific coefficients
onebp(y, z, x, h, start, last)
onebp(y, z, x, h, start, last)
y |
dependent variables |
z |
independent variables with coefficients allowed to change across regimes |
x |
independent variables with constant coefficients across regimes |
h |
minimal length of segment |
start |
initial date to search |
last |
last date to search |
A list containing the following components
ssrmin |
associated SSR of optimal break |
dx |
optimal date (global minimizer) |
Function calculates the optimal one break partition for a segment starting
from start to last. The possible range of the break is within
based on the vector of recursive SSR of the model
parti(start, b_start, b_end, last, bigvec, bigT)
parti(start, b_start, b_end, last, bigvec, bigT)
start |
start date index of the segment |
b_start |
first possible break date |
b_end |
last possible breakdate |
last |
end date index of the segment |
bigT |
sample period T |
A list containing the following components:
ssrmin |
associated SSR of optimal break |
dx |
optimal date (global minimizer) |
Function calculates an optimal one break partitions for a segment that starts at date start and ends at date last. It returns the optimal break and the associated SSR. Procedure used with the sequential method when the T*(T+1)/2 vector of SSR is not computed.
partione(b1, b2, last, vssr, vssrev)
partione(b1, b2, last, vssr, vssrev)
last |
end of segment considered |
vssr |
minimum SSRs of associated break date |
vssrev |
recursive SSRs of the model |
b_start |
first possible break date |
b_end |
last possible break date |
A list containing the following components:
ssrmin |
associated SSR of optimal break |
dx |
optimal date (global minimizer) |
Function compute the supF test statistics of testing procedure with
null hypothesis: no break versus alternative hypothesis: i
breaks.
pftest(y, z, i, q, bigT, datevec, prewhit, robust, x, p, hetdat, hetvar)
pftest(y, z, i, q, bigT, datevec, prewhit, robust, x, p, hetdat, hetvar)
y |
dependent variables |
z |
independent variables with coefficients are allowed to change across regimes |
i |
number of breaks in the model |
q |
number of |
bigT |
sample period T |
datevec |
|
prewhit |
Options for prewhitening process |
robust , hetdat , hetvar
|
options for assumptions on error terms |
x |
independent variables with constant coefficients across regimes |
p |
number of |
ftest SupF test results
Function constructs a diagonal matrix of dimension (m+1) by (m+1) matrix
with i-th entry
plambda(b, m, bigT)
plambda(b, m, bigT)
b |
Estimated date of changes |
m |
Number of breaks |
bigT |
The sample size T |
lambda (m+1) by (m+1) diagonal matrix
with i-th entry
'plot_model()' visualizes any object of class 'model' with comparison between real, fitted values between model of 'm' breaks and null model of '0' breaks with options for confidence interval of break date.
plot_model(model, CI = 0.95, title = NULL)
plot_model(model, CI = 0.95, title = NULL)
model |
object of class 'model' in 'mbreaks' package |
CI |
confidence intervals for break date and coefficient estimates visualize in terms of fitted values |
title |
title of the graph |
No return value, called for plotting class 'model' object. For more details on 'model' class, see [compile_model]
rate = dofix('rate',data=real,fixn=2) plot_model(rate,title='Ex-post US exchange rate')
rate = dofix('rate',data=real,fixn=2) plot_model(rate,title='Ex-post US exchange rate')
prepartion procedure
preparti(y, z, nbreak, dateseq, h, x, p)
preparti(y, z, nbreak, dateseq, h, x, p)
'print' prints the class 'mdl' object with default showing only certain procedures called by 'mdl()' function including: 'seqtests' class object, 'sbtests' class object, and 'model' class object using KT information criterion
## S3 method for class 'mdl' print(x, ...)
## S3 method for class 'mdl' print(x, ...)
x |
class 'mdl' object |
... |
further arguments passed to or from other methods |
No return value, only for printing 'model', 'sbtests' and 'seqtests' class objects invoked during 'mdl()'.
rate = mdl('rate',data=real) print(rate)
rate = mdl('rate',data=real) print(rate)
'print' the output of the S3 class 'model' with all relevant information:
name of procedure used to obtain number of breaks in the model
print a table summarizing the break date estimation (including confidence interval for the estimated date)
print a table summarizing the estimated coefficients for 'z' regressors
print a table summarizing the estimated coefficients for 'x' regressors (if any)
## S3 method for class 'model' print(x, ...)
## S3 method for class 'model' print(x, ...)
x |
object of S3 class 'model' |
... |
further arguments passed to or from other methods. |
No return value, called for printing to console the following information in 'x':
Basic details of the model: name of prodecures invoked, number of estimated breaks, pure/partial structural change model,global min SSR
'date_tab' summarizes estimated break dates, see compile_model
'RS_tab' summarizes estimated coefficients allowed to change
across regimes, see compile_model
'FS_tab' summarizes estimated coefficients constant across regimes,
see compile_model
'print' prints the following information from a 'sbtests' class object:
A table reports sup F tests of 0 versus '1' upto 'm' breaks with critical values for 1%, 2.5%, 5%, and 10% significance levels.
A table reporting Double Max tests with critical values for 1%, 2.5%, 5%, and 10% significance levels.
## S3 method for class 'sbtests' print(x, ...)
## S3 method for class 'sbtests' print(x, ...)
x |
class 'sbtests' object |
... |
further arguments passed to or from other methods |
No return value, only for printing formatted 'sbtests' class object to console
supF = dotest('inf','inflag',data=nkpc) print(supF)
supF = dotest('inf','inflag',data=nkpc) print(supF)
'print' prints the object of class 'seqtests' with the following information
Maximum number of breaks 'm' in the tests
'sfl' table with sequential sup F tests statistics of l versus l+1 breaks up to 'm' breaks
## S3 method for class 'seqtests' print(x, ...)
## S3 method for class 'seqtests' print(x, ...)
x |
'seqtests' class object. |
... |
further arguments passed to or from other methods. |
No return value, only for printing formatted 'seqtests' class object to console
seq_supF = doseqtests('inf','inflag',data=nkpc) print(seq_supF)
seq_supF = doseqtests('inf','inflag',data=nkpc) print(seq_supF)
Function computes a diagonal matrix of dimension m+1 by m+1 with i-th entry is the estimated variance of residuals of segment i
psigmq(res, b, q, m, nt)
psigmq(res, b, q, m, nt)
res |
big residual vector of the model |
b |
Estimated date of changes |
q |
Number of 'z' regressors |
m |
Number of breaks |
nt |
The size of 'z' regressors |
sigmat ('m'+1)x('m'+1) diagonal matrix with i-th entry equal to estimated variance of regime i
Covariance matrix of estimator delta construction
pvdel(y, z, i, q, bigT, b, prewhit, robust, x, p, withb, hetdat, hetvar)
pvdel(y, z, i, q, bigT, b, prewhit, robust, x, p, withb, hetdat, hetvar)
y |
dependent variable |
z |
matrix of independent variables with coefficients allowed to change across regimes |
i |
maximum number of breaks |
q |
number of regressors |
bigT |
sample period T |
b |
vector of estimated dates of breaks |
prewhit |
Option of using prewhitening process. If |
robust , withb , hetdat , hetvar
|
options for assumptions of error terms structure |
x |
atrix of independent variables with constant coefficients across regimes |
p |
number x regressors |
vdel Covariance matrix of delta
Data set from the Garcia and Perron study's of ex-post exchange rate.
real
real
## 'real' A data frame with 103 rows and 1 column:
Real exchange rate
Garcia, R. and Perron, P., 1996. "An analysis of the real interest rate under regime shifts." Review of Economics and Statistics 111–125.
sequential procedure to obtain number of breaks and break dates
sequa(m, signif, q, h, bigT, robust, prewhit, z, y, x, p, hetdat, hetvar, eps1)
sequa(m, signif, q, h, bigT, robust, prewhit, z, y, x, p, hetdat, hetvar, eps1)
'spflp1' computes the test statistics of supF(l+1|l) test with null hypothesis is l='nseg-1' and alternative hypothesis is l+1. The l breaks under the null hypothesis are taken from the global minimization.
spflp1(bigvec, dt, nseg, y, z, h, q, prewhit, robust, x, p, hetdat, hetvar)
spflp1(bigvec, dt, nseg, y, z, h, q, prewhit, robust, x, p, hetdat, hetvar)
bigvec |
associated SSR of estimated break date under H0 |
dt |
vector of estimated date under H0 |
nseg |
number of segment under H1 |
y |
matrix of dependent variable |
z |
matrix of variables with coefficients are allowed to change across regimes |
h |
minimum segment length |
q |
number of 'z' regressors |
prewhit , robust , hetdat , hetvar
|
options on residuals/errors. For more details, please refer to [mdl()] |
x |
matrix of variables with constant coefficients across regimes |
p |
number of 'x' regressors |
A list that contains the following:
Maximum value of test
Additional date in alternative hypothesis