| Title: | Unit Root Tests with Structural Breaks and Fully-Modified Estimators |
|---|---|
| Description: | Procedures include Phillips (1995) FMVAR <doi:10.2307/2171721>, Kitamura and Phillips (1997) FMGMM <doi:10.1016/S0304-4076(97)00004-3>, Park (1992) CCR <doi:10.2307/2951679>, and so on. Tests with 1 or 2 structural breaks include Gregory and Hansen (1996) <doi:10.1016/0304-4076(69)41685-7>, Zivot and Andrews (1992) <doi:10.2307/1391541>, and Kurozumi (2002) <doi:10.1016/S0304-4076(01)00106-3>. |
| Authors: | Ho Tsung-wu [aut, cre] |
| Maintainer: | Ho Tsung-wu <[email protected]> |
| License: | GPL (>= 2) |
| Version: | 0.0.3 |
| Built: | 2026-05-11 06:40:13 UTC |
| Source: | https://github.com/cran/COINT |
Compute the Bartlett kernel to obtain consistent estimate of long-run variance of multivariate time series.
bartlett(data,v)bartlett(data,v)
data |
Data matrix for computing consistent long-run variance, normally, multivariate regression residuals. |
v |
Number of autocovariance terms in the kernel. |
amat |
Return the consistent estimate of long-run variance. This procedure handles both multivariate and single time series, which is basically designed for "fmvar","fmgmm" and "fmols". |
weights |
The weights vector, used by function |
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University.
Brillinger, David R. (1981) Time Series Data Analysis and Theory. San Francisco, CA: Holden-Day.
data(macro) e=apply(macro, 2, function(x) x-mean(x)) bartlett(e,v=15)data(macro) e=apply(macro, 2, function(x) x-mean(x)) bartlett(e,v=15)
Compute the Bartlett kernel to obtain consistent estimate of long-run variance,univariate time series only.
Bartlett_uni(e,v)Bartlett_uni(e,v)
e |
A univariate time series for computing consistent long-run variance, normally, regression residuals. |
v |
Number of lag terms used to compute the long-run variance. |
Return the consistent estimate of long-run variance, that PP and KPSS tests require. This procedure handles single time series only.
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University.
Brillinger, David R. (1981) Time Series Data Analysis and Theory. San Francisco, CA: Holden-Day.
data(macro) y=macro[,"INF"] e=y-mean(y) Bartlett_uni(e,v=15)data(macro) y=macro[,"INF"] e=y-mean(y) Bartlett_uni(e,v=15)
Computes the Bohman window to obtain consistent estimate of long-run variance of multivariate time series.
bohman(data,v)bohman(data,v)
data |
Data matrix for computing consistent long-run variance, normally, multivariate regression residuals. |
v |
Number of autocovariance terms in the kernel. |
amat |
Return the consistent estimate of long-run variance. This procedure handles both multivariate and single time series, which is basically designed for "fmvar","fmgmm" and "fmols". |
weights |
The weights vector, used by function |
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University.
Brillinger, David R. (1981) Time Series Data Analysis and Theory. San Francisco, CA: Holden-Day.
data(macro) e=apply(macro, 2, function(x) x-mean(x)) bohman(e,v=15)data(macro) e=apply(macro, 2, function(x) x-mean(x)) bohman(e,v=15)
Compute the Cauchy window to obtain consistent estimate of long-run variance of multivariate time series.
cauchy(data,v)cauchy(data,v)
data |
Data matrix for computing consistent long-run variance, normally, multivariate regression residuals. |
v |
Number of autocovariance terms in the kernel. |
amat |
Return the consistent estimate of long-run variance. This procedure handles both multivariate and single time series, which is basically designed for "fmvar","fmgmm" and "fmols". |
weights |
The weights vector, used by function |
Ho Tsung-wu
Brillinger, David R. (1981) Time Series Data Analysis and Theory. San Francisco, CA: Holden-Day.
data(macro) e=apply(macro, 2, function(x) x-mean(x)) cauchy(e,v=15)data(macro) e=apply(macro, 2, function(x) x-mean(x)) cauchy(e,v=15)
Computes Park's (1992) Canonical Cointegrating Regression estimator for cointegrated regression models, using OLS for the first stage regression.
ccr(y,x,type=c("const","trend","season","all"), v=15,ker_fun="parzen",aband=0,filter=0)ccr(y,x,type=c("const","trend","season","all"), v=15,ker_fun="parzen",aband=0,filter=0)
y |
The data of dependent variable in a regression. |
x |
The data of independent variables in a regression. |
type |
The deterministic parts in the regression. |
v |
Number of autocovariance terms to compute the spectrum at frequency zero, default=15. |
ker_fun |
Set kernel function to one of the available kernels, default="parzen". See section |
aband |
Whether to activate the automatic bandwidth selection. |
filter |
Whether to use an AR(1) filter to compute the spectrum at frequency zero. |
1. Available kernels. Technical details are referred to Brillinger (1981,P.55)
"parzen"=Parzen kernel
"bartlett"=Bartlett kernel
"dchlet"= Dirichlet kernel
"mdchlet"= Modified Dirichlet kernel
"tukham"=Tukey-Hamming kernel
"tukhan"=Tukey-Hanning kernel
"cauchy"=Cauchy kernel
"bohman"=Bohman kernel
"reisz"=Riesz,Bochner kernel
"gw"= Gauss-Weierstrass kernel
"qs"= Andrews (1991) Quadratic-Spectral
These kernels are written for ccr procedures, technically different from those used in pp and kpss tests.
2. Andrews (1991) has developed data based (or automatic) bandwidth procedures for computing the spectrum. COINT implements these procedures for the Parzen, Bartlette, Tukey-Hamming, and the Quadratic-Spectral kernels. When aband is active, COINT ignores the value you specify for the band-width parameter and automatically substitutes the data-based value.
3. The aim of the AR(1) filter is to flatten the spectrum of residual around the zero frequency, thereby making it easier to estimate the true spectrum by simple averaging of the periodogram.
coefTable |
Coefficients table. |
vcov |
Variance-covariance matrix for the parameter estimates. |
sigma |
Standard error of the residuals. |
rss |
Residual sum of squares. |
fit |
The fitted values, or conditional mean, of the regression. |
resid |
Estimated residuals. |
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University.
Park, J. Y. (1992) Canonical Cointegrating Regressions. Econometrica, 60, 119-144.
data(macro) y=macro[,1] x=macro[,-1] out=ccr(y,x,type=c("const","trend","season","all")[1],v=15,ker_fun="parzen") out$coefTable out$vcov tail(out$fit) tail(out$resid)data(macro) y=macro[,1] x=macro[,-1] out=ccr(y,x,type=c("const","trend","season","all")[1],v=15,ker_fun="parzen") out$coefTable out$vcov tail(out$fit) tail(out$resid)
Computes Park's (1992) canonical cointegrating regression estimator for cointegrated regressions with time polynomial, using OLS for the first stage regression.
ccrQ(y, x, type=c("trend","all"), v=15, q=2, ker_fun="parzen", aband=0, filter=0)ccrQ(y, x, type=c("trend","all"), v=15, q=2, ker_fun="parzen", aband=0, filter=0)
y |
The data of dependent variable in a regression. |
x |
The data of independent variables in a regression. |
type |
The deterministic parts in the regression. |
v |
Number of autocovariance terms to compute the spectrum at frequency zero, default=15. |
q |
degree of time polynomial, default=2. |
ker_fun |
Set kernel function to one of the available kernels, default="parzen". See section |
aband |
Whether to activate the automatic bandwidth selection. |
filter |
Whether to use an AR(1) filter to compute the spectrum at frequency zero. |
1. Available kernels. Technical details are referred to Brillinger (1981,P.55)
"parzen"=Parzen kernel
"bartlett"=Bartlett kernel
"dchlet"= Dirichlet kernel
"mdchlet"= Modified Dirichlet kernel
"tukham"=Tukey-Hamming kernel
"tukhan"=Tukey-Hanning kernel
"cauchy"=Cauchy kernel
"bohman"=Bohman kernel
"reisz"=Riesz,Bochner kernel
"gw"= Gauss-Weierstrass kernel
"qs"= Andrews (1991) Quadratic-Spectral
These kernels are written for ccrQ procedures, technically different from those used in pp and kpss tests.
2. Andrews (1991) has developed data based (or automatic) bandwidth procedures for computing the spectrum. COINT implements these procedures for the Parzen, Bartlette, Tukey-Hamming, and the Quadratic-Spectral kernels. When aband is active, COINT ignores the value you specify for the band-width parameter and automatically substitutes the data-based value.
3. The aim of the AR(1) filter is to flatten the spectrum of residual around the zero frequency, thereby making it easier to estimate the true spectrum by simple averaging of the periodogram.
coefTable |
Coefficients table. |
vcov |
Variance-covariance matrix for the parameter estimates. |
sigma |
Standard error of the residuals. |
rss |
Residual sum of squares. |
fit |
The fitted values, or conditional mean, of the regression. |
resid |
Estimated residuals. |
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University.
Park, J. Y. (1992) Canonical Cointegrating Regressions. Econometrica, 60, 119-144.
data(macro) y=macro[,1] x=macro[,-1] out=ccrQ(y,x,q=3,type=c("trend","all")[1],v=15,ker_fun="parzen") out$coefTable out$vcov tail(out$fit) tail(out$resid)data(macro) y=macro[,1] x=macro[,-1] out=ccrQ(y,x,q=3,type=c("trend","all")[1],v=15,ker_fun="parzen") out$coefTable out$vcov tail(out$fit) tail(out$resid)
Test the null hypothesis of no cointegration between y and x using Phillips' (1987) Za and Zt statistics and Phillips and Ouliaris (1990) limit theory.
CZa(y,x,p=1,v=15)CZa(y,x,p=1,v=15)
y |
The data of dependent variable in a regression. |
x |
The data of independent variables in a regression. |
p |
Order of the time polynomial in the cointegrating regressio. Critical values are available for p within [1,5]. |
v |
Number of autocovariance terms to compute the spectrum at frequency zero, default=15. |
alpha |
Estimate of the AR(1) coefficient. |
cza |
Za statistic for non-cointegration.Reject the null hypothesis of no cointegration if the Z statistic < critical value. |
cza_cv |
Critical values of cza. |
czt |
Zt statistic for non-cointegration.Reject the null hypothesis of no cointegration if the Z statistic < critical value. |
czt_cv |
Critical values of czt. |
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University.
Phillips, P. C. B. (1987) Time Series Regression with a Unit Root. Econometrica, 55, 277-301.
Phillips, P. C. B. and Ouliaris S. (1990) Asymptotic Properties of Residual Based Tests for Cointegration. Econometrica, 58, 165-193.
data(macro) y=macro[,1] x=macro[,-1] CZa(y,x,p=1,v=10)data(macro) y=macro[,1] x=macro[,-1] CZa(y,x,p=1,v=10)
macro contains monthly observations from 1967M1 to 2025M7 for the unemployment rate (the dependent variable), IC (Initial Claims of unemployment insurance), inflation rate (seasonal growth rate of CPI), industrial growth (seasonal growth rate of the industrial production index).r
data(macro)data(macro)
macro is an object of class timeSeries.
Computes the Dirichlet window to obtain consistent estimate of long-run variance of multivariate time series.
dchlet(data,v)dchlet(data,v)
data |
Data matrix for computing consistent long-run variance, normally, multivariate regression residuals. |
v |
Number of autocovariance terms in the kernel. |
amat |
Return the consistent estimate of long-run variance. This procedure handles both multivariate and single time series, which is basically designed for "fmvar","fmgmm" and "fmols". |
weights |
The weights vector, used by function |
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University.
Brillinger, David R. (1981) Time Series Data Analysis and Theory. San Francisco, CA: Holden-Day.
data(macro) e=apply(macro, 2, function(x) x-mean(x)) dchlet(e,v=15)data(macro) e=apply(macro, 2, function(x) x-mean(x)) dchlet(e,v=15)
Computes the Phillips-Hansen (1990) Fully-Modified estimator for cointegrated regressions, using OLS for the first stage regression.
fm(y, x, type=c("const","trend","season","all"), v=15, ker_fun="parzen", aband=0, filter=0, sb_start=0.15)fm(y, x, type=c("const","trend","season","all"), v=15, ker_fun="parzen", aband=0, filter=0, sb_start=0.15)
y |
The data of dependent variable in a regression. |
x |
The data of independent variables in a regression. |
type |
The deterministic parts in the regression. |
v |
Number of autocovariance terms to compute the spectrum at frequency zero, default=15. |
ker_fun |
Set kernel function to one of the available kernels, default="parzen". See section |
aband |
Whether to use the automatic bandwidth selection. |
filter |
Whether to activate an AR(1) filter to compute the spectrum at frequency zero. |
sb_start |
The percentage specifies the beginning of sub-sample for stability test, and the end sample is (1-sb_start). |
1. Available kernels. Technical details are referred to Brillinger (1981,P.55)
"parzen"=Parzen kernel
"bartlett"=Bartlett kernel
"dchlet"= Dirichlet kernel
"mdchlet"= Modified Dirichlet kernel
"tukham"=Tukey-Hamming kernel
"tukhan"=Tukey-Hanning kernel
"cauchy"=Cauchy kernel
"bohman"=Bohman kernel
"reisz"=Riesz,Bochner kernel
"gw"= Gauss-Weierstrass kernel
"qs"= Andrews (1991) Quadratic-Spectral
These kernels are written for FM procedures, technically different from those used in pp and kpss tests.
2. Andrews (1991) has developed data based (or automatic) bandwidth procedures for computing the spectrum. COINT implements these procedures for the Parzen, Bartlette, Tukey-Hamming, and the Quadratic-Spectral kernels. When aband is active, COINT ignores the value you specify for the band-width parameter and automatically substitutes the data-based value.
3. The aim of the AR(1) filter is to flatten the spectrum of residual around the zero frequency, thereby making it easier to estimate the true spectrum by simple averaging of the periodogram.
coefTable |
Coefficients table. |
vcov |
Variance-covariance matrix for the parameter estimates. |
sigma |
Standard error of the residuals. |
rss |
Residual sum of squares. |
fit |
The fitted values, or conditional mean, of the regression. |
stests |
3x1 vector containing Hansen's (1992) Lc, MeanF, and SupF (in this order) statistics for testing the null hypothesis that the cointegrating vector is stable over the sample period. |
resid |
Estimated residuals. |
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University.
Andrews, D. W. K. (1991) Heteroskedasticity and Autocorrelation Consistent Covariance Matrix Estimation.Econometrica, 59: 817-858.
Brillinger, David R. (1981) Time Series Data Analysis and Theory. San Francisco, CA: Holden-Day.
Hansen, B. E. (1992) Tests for Parameter Instability in Regressions with I(1) Processes. Journal of Business and Economic Statistics, 10, 321-335.
Phillips, P. C. B. and Hansen B. E.(1990) Statistical Inference in Instrumental Variables Regression with I(1) Processes. Review of Economic Studies, 57, 99-125.
data(macro) y=macro[,1] x=macro[,-1] out=fm(y,x,type=c("const","trend","season","all")[2],v=15,ker_fun="parzen") out$coefTable out$vcov out$stests tail(out$fit) tail(out$resid)data(macro) y=macro[,1] x=macro[,-1] out=fm(y,x,type=c("const","trend","season","all")[2],v=15,ker_fun="parzen") out$coefTable out$vcov out$stests tail(out$fit) tail(out$resid)
Computes the Kitamura-Phillips (1997) Fully-Modified GIVE estimator for univariate and multivariate cointegrated regression models.
fmgive(y,x,z,v,t,ker_fun="parzen",times=5)fmgive(y,x,z,v,t,ker_fun="parzen",times=5)
y |
The data of dependent variable(s) in a regression. |
x |
The data of independent variables in a regression. |
z |
Instruments |
v |
Number of autocovariance terms to compute the spectrum at frequency zero, default=15. |
t |
number of terms to use in the computation of the WT matrix. |
ker_fun |
Set kernel function to one of the available kernels, default="parzen". See section |
times |
Number of iteration to compute GIVE residuals, default =5. |
1. Like FMOLS, fmgmm allows both single equation and multivariate system of equations. The multvariate case is a system that many dependent variables to common Xs.
2. Available kernels. Technical details are referred to Brillinger (1981,P.55)
"parzen"=Parzen kernel
"bartlett"=Bartlett kernel
"dchlet"= Dirichlet kernel
"mdchlet"= Modified Dirichlet kernel
"tukham"=Tukey-Hamming kernel
"tukhan"=Tukey-Hanning kernel
"cauchy"=Cauchy kernel
"bohman"=Bohman kernel
"reisz"=Riesz,Bochner kernel
"gw"= Gauss-Weierstrass kernel
"qs"= Andrews (1991) Quadratic-Spectral
These kernels are written for FM procedures, technically different from those used in pp and kpss tests.
3. Andrews (1991) has developed data based (or automatic) bandwidth procedures for computing the spectrum. COINT implements these procedures for the Parzen, Bartlette, Tukey-Hamming, and the Quadratic-Spectral kernels. When aband is active, COINT ignores the value you specify for the band-width parameter and automatically substitutes the data-based value.
4. The aim of the AR(1) filter is to flatten the spectrum of residual around the zero frequency, thereby making it easier to estimate the true spectrum by simple averaging of the periodogram.
beta |
Coefficient estimates. |
stderr |
Standard error of the residuals. |
tstat |
t-statistics of parameter estimates. |
vcov |
Variance-covariance matrix for the parameter estimates. |
lromega |
long-run variance-covariance matrix of residuals. |
s1 |
The first statistic for testing validity of overidentifying restrictions. |
s2 |
The second statistic for testing validity of overidentifying restrictions. |
pvalue |
The p-value for s1+s2. |
fit |
The fitted values, or conditional mean, of the regression. |
resid |
GMM residuals. |
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University.
Kitamura, Y. and P. C. B. Phillips (1997) Fully-Modified IV, GIVE and GMM Estimation with Possibly Nonstationary Regressors and Instruments. Journal of Econometrics, 80, 85-123.
data(macro) y=macro[-1,c(1)] x=macro[-1,c(2,4)] z=as.matrix(na.omit(exp(diff(macro)))) #IV out=fmgive(y,x,z,v=15,t=5,ker_fun="parzen") out$beta out$vcov out$stderr out$tstat #t-ratio tail(out$fit) tail(out$resid) y=macro[-1,c(1,3)] x=macro[-1,c(2,4)] z=as.matrix(na.omit(exp(diff(macro)))) #IV out=fmgive(y,x,z,v=15,t=5,ker_fun="parzen") out$betadata(macro) y=macro[-1,c(1)] x=macro[-1,c(2,4)] z=as.matrix(na.omit(exp(diff(macro)))) #IV out=fmgive(y,x,z,v=15,t=5,ker_fun="parzen") out$beta out$vcov out$stderr out$tstat #t-ratio tail(out$fit) tail(out$resid) y=macro[-1,c(1,3)] x=macro[-1,c(2,4)] z=as.matrix(na.omit(exp(diff(macro)))) #IV out=fmgive(y,x,z,v=15,t=5,ker_fun="parzen") out$beta
Computes the Kitamura-Phillips (1997) Fully-Modified GMM estimator for univariate and multivariate cointegrated regression models.
fmgmm(y,x,z,v,ker_fun="parzen",times=5)fmgmm(y,x,z,v,ker_fun="parzen",times=5)
y |
The data of dependent variable(s) in a regression. |
x |
The data of independent variables in a regression. |
z |
Instruments |
v |
Number of autocovariance terms to compute the spectrum at frequency zero, default=15. |
ker_fun |
Set kernel function to one of the available kernels, default="parzen". See section |
times |
Number of iteration to compute GMM residuals, default =5. |
1. Like FMOLS, fmgmm allows both single equation and multivariate system of equations. The multvariate case is a system that many dependent variables to common Xs.
2. Available kernels. Technical details are referred to Brillinger (1981,P.55)
"parzen"=Parzen kernel
"bartlett"=Bartlett kernel
"dchlet"= Dirichlet kernel
"mdchlet"= Modified Dirichlet kernel
"tukham"=Tukey-Hamming kernel
"tukhan"=Tukey-Hanning kernel
"cauchy"=Cauchy kernel
"bohman"=Bohman kernel
"reisz"=Riesz,Bochner kernel
"gw"= Gauss-Weierstrass kernel
"qs"= Andrews (1991) Quadratic-Spectral
These kernels are written for FM procedures, technically different from those used in pp and kpss tests.
3. Andrews (1991) has developed data based (or automatic) bandwidth procedures for computing the spectrum. COINT implements these procedures for the Parzen, Bartlette, Tukey-Hamming, and the Quadratic-Spectral kernels. When aband is active, COINT ignores the value you specify for the band-width parameter and automatically substitutes the data-based value.
4. The aim of the AR(1) filter is to flatten the spectrum of residual around the zero frequency, thereby making it easier to estimate the true spectrum by simple averaging of the periodogram.
beta |
Coefficient estimates. |
stderr |
Standard error of the residuals. |
tstat |
t-statistics of parameter estimates. |
vcov |
Variance-covariance matrix for the parameter estimates. |
lromega |
long-run variance-covariance matrix of residuals. |
s1 |
The first statistic for testing validity of overidentifying restrictions. |
s2 |
The second statistic for testing validity of overidentifying restrictions. |
pvalue |
The p-value for s1+s2. |
fit |
The fitted values, or conditional mean, of the regression. |
resid |
GMM residuals. |
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University.
Kitamura, Y. and P. C. B. Phillips (1997) Fully-Modified IV, GIVE and GMM Estimation with Possibly Nonstationary Regressors and Instruments. Journal of Econometrics, 80, 85-123.
data(macro) y=macro[-1,c(1)] x=macro[-1,c(2,3)] z=as.matrix(na.omit(exp(diff(macro)))) #IV out=fmgmm(y,x,z,v=15,ker_fun="parzen") out$beta out$vcov out$stderr out$tstat #t-ratio tail(out$fit) tail(out$resid)data(macro) y=macro[-1,c(1)] x=macro[-1,c(2,3)] z=as.matrix(na.omit(exp(diff(macro)))) #IV out=fmgmm(y,x,z,v=15,ker_fun="parzen") out$beta out$vcov out$stderr out$tstat #t-ratio tail(out$fit) tail(out$resid)
Phillips' (1995) Fully-Modified OLS estimator for single equation and multivariate cointegrated regression models.
fmols(y, x, type=c("const","trend","season","all"), v=15, ker_fun="parzen", aband=0, filter=1)fmols(y, x, type=c("const","trend","season","all"), v=15, ker_fun="parzen", aband=0, filter=1)
y |
The data of dependent variable(s) in a regression. |
x |
The data of independent variables in a regression. |
type |
The deterministic parts in the regression. |
v |
Number of autocovariance terms to compute the spectrum at frequency zero, default=15. |
ker_fun |
Set kernel function to one of the available kernels, default="parzen". See section |
aband |
Whether to activate the automatic bandwidth selection. |
filter |
Whether to use an AR(1) filter to compute the spectrum at frequency zero. |
1. This fmols allows both single equation and multivariate system of equations. The multvariate case is a system that many dependent variables to common Xs.
2. Available kernels. Technical details are referred to Brillinger (1981,P.55)
"parzen"=Parzen kernel
"bartlett"=Bartlett kernel
"dchlet"= Dirichlet kernel
"mdchlet"= Modified Dirichlet kernel
"tukham"=Tukey-Hamming kernel
"tukhan"=Tukey-Hanning kernel
"cauchy"=Cauchy kernel
"bohman"=Bohman kernel
"reisz"=Riesz,Bochner kernel
"gw"= Gauss-Weierstrass kernel
"qs"= Andrews (1991) Quadratic-Spectral
These kernels are written for fmols procedures, technically different from those used in pp and kpss tests.
3. Andrews (1991) has developed data based (or automatic) bandwidth procedures for computing the spectrum. COINT implements these procedures for the Parzen, Bartlette, Tukey-Hamming, and the Quadratic-Spectral kernels. When aband is active, COINT ignores the value you specify for the band-width parameter and automatically substitutes the data-based value.
4. The aim of the AR(1) filter is to flatten the spectrum of residual around the zero frequency, thereby making it easier to estimate the true spectrum by simple averaging of the periodogram.
beta |
Coefficient estimates. |
stderr |
Standard error of the residuals. |
tstat |
t-statistics of parameter estimates. |
vcov |
Variance-covariance matrix for the parameter estimates. |
fit |
The fitted values, or conditional mean, of the regression. |
resid |
Estimated residuals. |
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University.
Phillips, P. C. B (1995) Fully Modified Least Squares and Vector Autoregression, Econometrica, 63, 1023-1078.
data(macro) y=macro[,1:2] x=macro[,3:4] out=fmols(y,x,type=c("const","trend","season","all")[2],v=15,ker_fun="bartlett") out$beta out$stderr out$tstat #t-ratio out$vcov tail(out$fit) tail(out$resid)data(macro) y=macro[,1:2] x=macro[,3:4] out=fmols(y,x,type=c("const","trend","season","all")[2],v=15,ker_fun="bartlett") out$beta out$stderr out$tstat #t-ratio out$vcov tail(out$fit) tail(out$resid)
Computes the Phillips-Hansen (1990) Fully-Modified estimator for cointegrated regressions with Time Polynomial, using OLS for the first stage regression.
fmQ(y,x,type=c("trend","all"),v=15, q=2, ker_fun="parzen",aband=0,filter=0,sb_start=0.15)fmQ(y,x,type=c("trend","all"),v=15, q=2, ker_fun="parzen",aband=0,filter=0,sb_start=0.15)
y |
The data of dependent variable in a regression. |
x |
The data of independent variables in a regression. |
type |
The deterministic parts in the regression. |
v |
Number of autocovariance terms to compute the spectrum at frequency zero, default=15. |
q |
degree of time polynomial, default=2. |
ker_fun |
Set kernel function to one of the available kernels, default="parzen". See section |
aband |
Whether to activate the automatic bandwidth selection. |
filter |
Whether to use an AR(1) filter to compute the spectrum at frequency zero. |
sb_start |
The percentage specifies the beginning of sub-sample for stability test, and the end sample is (1-sb_start). |
1. Available kernels. Technical details are referred to Brillinger (1981,P.55)
"parzen"=Parzen kernel
"bartlett"=Bartlett kernel
"dchlet"= Dirichlet kernel
"mdchlet"= Modified Dirichlet kernel
"tukham"=Tukey-Hamming kernel
"tukhan"=Tukey-Hanning kernel
"cauchy"=Cauchy kernel
"bohman"=Bohman kernel
"reisz"=Riesz,Bochner kernel
"gw"= Gauss-Weierstrass kernel
"qs"= Andrews (1991) Quadratic-Spectral
These kernels are written for fmQ procedures, technically different from those used in pp and kpss tests.
2. Andrews (1991) has developed data based (or automatic) bandwidth procedures for computing the spectrum. COINT implements these procedures for the Parzen, Bartlette, Tukey-Hamming, and the Quadratic-Spectral kernels. When aband is active, COINT ignores the value you specify for the band-width parameter and automatically substitutes the data-based value.
3. The aim of the AR(1) filter is to flatten the spectrum of residual around the zero frequency, thereby making it easier to estimate the true spectrum by simple averaging of the periodogram.
coefTable |
Coefficients table. |
vcov |
Variance-covariance matrix for the parameter estimates. |
sigma |
Standard error of the residuals. |
rss |
Residual sum of squares. |
fit |
The fitted values, or conditional mean, of the regression. |
resid |
Estimated residuals. |
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University.
Andrews, D. W. K. (1991) Heteroskedasticity and Autocorrelation Consistent Covariance Matrix Estimation.Econometrica, 59: 817-858.
Brillinger, David R. (1981) Time Series Data Analysis and Theory. San Francisco, CA: Holden-Day.
Hansen, B. E. (1992) Tests for Parameter Instability in Regressions with I(1) Processes. Journal of Business and Economic Statistics, 10, 321-335.
Phillips, P. C. B. and Hansen B. E.(1990) Statistical Inference in Instrumental Variables Regression with I(1) Processes. Review of Economic Studies, 57, 99-125.
data(macro) y=macro[,1] x=macro[,-1] out=fmQ(y,x,type=c("trend","all")[1],v=15,q=3,ker_fun="parzen") out$coefTable out$vcov out$stests tail(out$fit) tail(out$resid)data(macro) y=macro[,1] x=macro[,-1] out=fmQ(y,x,type=c("trend","all")[1],v=15,q=3,ker_fun="parzen") out$coefTable out$vcov out$stests tail(out$fit) tail(out$resid)
Computes the Phillips' (1995) Fully-Modified" VAR estimator for cointegrated regressions, using OLS for the first stage regression.
fmvar(data,p=1,q=5,v=15,type=c("const","trend","season","all"), ker_fun="parzen",aband=0,filter=0)fmvar(data,p=1,q=5,v=15,type=c("const","trend","season","all"), ker_fun="parzen",aband=0,filter=0)
data |
The dependent variables for a VAR system. |
p |
The number of lags for dependent variables, as in a VAR(p). |
q |
The number of lagged innovation terms to include in the fitted FMVAR(p,q). |
v |
Number of autocovariance terms to compute the spectrum at frequency zero, default=15. |
type |
The deterministic parts in the regression. Please note that fmvar will "de-" before inclusion, for example, |
ker_fun |
Set kernel function to one of the available kernels, default="parzen". See section |
aband |
Whether to activate the automatic bandwidth selection. |
filter |
Whether to use an AR(1) filter to compute the spectrum at frequency zero. |
1. Available kernels. Technical details are referred to Brillinger (1981,P.55)
"parzen"=Parzen kernel
"bartlett"=Bartlett kernel
"dchlet"= Dirichlet kernel
"mdchlet"= Modified Dirichlet kernel
"tukham"=Tukey-Hamming kernel
"tukhan"=Tukey-Hanning kernel
"cauchy"=Cauchy kernel
"bohman"=Bohman kernel
"reisz"=Riesz,Bochner kernel
"gw"= Gauss-Weierstrass kernel
"qs"= Andrews (1991) Quadratic-Spectral
These kernels are written for FM procedures, technically different from those used in pp and kpss tests.
2. Andrews (1991) has developed data based (or automatic) bandwidth procedures for computing the spectrum. COINT implements these procedures for the Parzen, Bartlette, Tukey-Hamming, and the Quadratic-Spectral kernels. When aband is active, COINT ignores the value you specify for the band-width parameter and automatically substitutes the data-based value.
3. The aim of the AR(1) filter is to flatten the spectrum of residual around the zero frequency, thereby making it easier to estimate the true spectrum by simple averaging of the periodogram.
beta |
Coefficient estimates. |
stderr |
Standard error of the residuals. |
tstat |
t-statistics of parameter estimates. |
vcov |
Variance-covariance matrix for the parameter estimates. |
fit |
The fitted values, or conditional mean, of the regression. |
resid |
Estimated residuals. |
data |
The data used in |
type |
The type used in |
p |
The p argument used in |
q |
The q argument used in |
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University.
Phillips, P. C. B (1995) Fully Modified Least Squares and Vector Autoregression. Econometrica, 63, 1023-1078.
data(macro) out=fmvar(macro,p=1,q=6,v=15,type="trend",ker_fun="parzen",aband=0,filter=0) out$beta out$stderr out$tstat out$vcov tail(out$data) tail(out$resid) ID1=grep(rownames(out$beta),pattern="_dL") ID2=grep(rownames(out$beta),pattern="_L") ID3=rownames(out$beta)[-c(ID1,ID2)] out$beta[ID1,]; #innovation terms out$beta[ID2,]; #VAR(1) out$beta[ID3,]; #deterministic partsdata(macro) out=fmvar(macro,p=1,q=6,v=15,type="trend",ker_fun="parzen",aband=0,filter=0) out$beta out$stderr out$tstat out$vcov tail(out$data) tail(out$resid) ID1=grep(rownames(out$beta),pattern="_dL") ID2=grep(rownames(out$beta),pattern="_L") ID3=rownames(out$beta)[-c(ID1,ID2)] out$beta[ID1,]; #innovation terms out$beta[ID2,]; #VAR(1) out$beta[ID3,]; #deterministic parts
Forecast a VAR generated by fmvar_forecast.
fmvar_forecast(output, n.ahead=6)fmvar_forecast(output, n.ahead=6)
output |
The output object of fmvar_forecast. |
n.ahead |
The steps of out-of-sample forecasting. |
This function recursively computes the n.ahead steps of out-of-sample forecasting.
Forecasted values of all endogenous variables.
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University.
data(macro) out=fmvar(macro,p=1,q=6,v=10,type="trend",ker_fun="parzen") fmvar_forecast(out,n.ahead=6)data(macro) out=fmvar(macro,p=1,q=6,v=10,type="trend",ker_fun="parzen") fmvar_forecast(out,n.ahead=6)
Select the q for a FMVAR(p,q) for cointegrated regressions.
fmvar_plag(data, p=1, lag.max=12, v=15, type=c("const","trend","season","all"), ker_fun="parzen", aband=0, filter=0)fmvar_plag(data, p=1, lag.max=12, v=15, type=c("const","trend","season","all"), ker_fun="parzen", aband=0, filter=0)
data |
The dependent variables for a VAR system. |
p |
The number of lags for dependent variables, as in a standard VAR(p). |
lag.max |
The maxum number of lags used to search for optimal q in fmvar(p,q). |
v |
Number of autocovariance terms to compute the spectrum at frequency zero, default=15. |
type |
The deterministic parts in the regression. |
ker_fun |
Set kernel function to one of the available kernels, default="parzen". See section |
aband |
Whether to activate the automatic bandwidth selection. |
filter |
Whether to use an AR(1) filter to compute the spectrum at frequency zero. |
1. Available kernels. Technical details are referred to Brillinger (1981,P.55)
"parzen"=Parzen kernel
"bartlett"=Bartlett kernel
"dchlet"= Dirichlet kernel
"mdchlet"= Modified Dirichlet kernel
"tukham"=Tukey-Hamming kernel
"tukhan"=Tukey-Hanning kernel
"cauchy"=Cauchy kernel
"bohman"=Bohman kernel
"reisz"=Riesz,Bochner kernel
"gw"= Gauss-Weierstrass kernel
"qs"= Andrews (1991) Quadratic-Spectral
These kernels are written for fm.ols procedures, technically different from those used in pp and kpss tests.
2. Andrews (1991) has developed data based (or automatic) bandwidth procedures for computing the spectrum. COINT implements these procedures for the Parzen, Bartlette, Tukey-Hamming, and the Quadratic-Spectral kernels. When aband is active, COINT ignores the value you specify for the band-width parameter and automatically substitutes the data-based value.
3. The aim of the AR(1) filter is to flatten the spectrum of residual around the zero frequency, thereby making it easier to estimate the true spectrum by simple averaging of the periodogram.
selection |
The selected order of q: the selected lagged innovation terms to include in the fitted FMVAR(p,q) |
criteria |
The matrix of all lags and the values of four criteria: "AIC(q)", "HQ(q)", "SC(q)", "FPE(q)". |
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University.
Phillips, P. C. B (1995) Fully Modified Least Squares and Vector Autoregression. Econometrica, 63, 1023-1078.
data(macro) Q=fmvar_plag(macro, p=1, v=15, lag.max=16,type="trend", ker_fun="parzen")$selection[1] out=fmvar(macro,p=1,q=Q,v=15,type="trend", ker_fun="parzen")data(macro) Q=fmvar_plag(macro, p=1, v=15, lag.max=16,type="trend", ker_fun="parzen")$selection[1] out=fmvar(macro,p=1,q=Q,v=15,type="trend", ker_fun="parzen")
Conduct the cointegration analysis with regime shifts, proposed by Gregory-Hansen (1996A).
GHansen(y, x, model,trim=0.1, use=c("nw","ba"))GHansen(y, x, model,trim=0.1, use=c("nw","ba"))
y |
The data of dependent variable in a regression. |
x |
The data of independent variables in a regression. |
model |
Models for the structural breaks: |
trim |
The trimming percentage. Default is 10 percent. |
use |
Conditions for |
This function calculates three residual-based test for cointegration with regime shifts: ADF, and Za, Zt of pp.
Argument use is detailed by the example of pp documentation.
result |
Comprehensive results of three tests. |
teststat |
Time series of three sequential tests. |
test.reg.adf |
Final regression output for ADF test. |
test.reg.za |
Final regression output for Za test. |
test.reg.zt |
Final regression output for Zt test. |
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University.
Gregory, A.W. and Hansen, B. E. (1996A) Residual-based tests for cointegration in models with regime shifts.Journal of Econometrics, 70, 99-126.
Gregory, A.W. and Hansen, B. E.(1996B). Tests for Cointegration in Models with Regime and Trend Shifts. Oxford Bulletin Economics and Statistics, 58(3), 555-560.
data(macro) y=macro[1:200,1] x=macro[1:200,-1] output=GHansen(y,x,model=1, use=c("nw","ba")) output$result summary(output$test.reg.adf) head(output$teststat) #Plotting test.name=rownames(output$result)[1] stat=output$teststat[,test.name] CV=output$result[test.name,1:3] bpoint=output$result[test.name,5] main=paste(paste(unlist(strsplit(test.name,"_")),collapse = " "),"test") plot(stat,main=main,ylab="",xlab="",ylim=range(c(max(stat)+3,min(stat)-1,CV)));grid() abline(h=CV[1],col="red") abline(h=CV[2],col="blue") abline(h=CV[3],col="seagreen") abline(v=as.POSIXct(time(y)[bpoint]),col="orange",lty=2) # legend(x=as.POSIXct("2010-01-01"), y=max(stat)+3, legend=c("1% cv" , "5% cv", "10% cv"), # col=c("red", "blue", "seagreen"),xjust=1, yjust=1, lty=1, # horiz=TRUE, cex=0.66, bty="n") #plot(y,main=colnames(y),ylab="",xlab="");grid() #abline(v=time(y[output$bpoint,]),col="orange",lty=2)data(macro) y=macro[1:200,1] x=macro[1:200,-1] output=GHansen(y,x,model=1, use=c("nw","ba")) output$result summary(output$test.reg.adf) head(output$teststat) #Plotting test.name=rownames(output$result)[1] stat=output$teststat[,test.name] CV=output$result[test.name,1:3] bpoint=output$result[test.name,5] main=paste(paste(unlist(strsplit(test.name,"_")),collapse = " "),"test") plot(stat,main=main,ylab="",xlab="",ylim=range(c(max(stat)+3,min(stat)-1,CV)));grid() abline(h=CV[1],col="red") abline(h=CV[2],col="blue") abline(h=CV[3],col="seagreen") abline(v=as.POSIXct(time(y)[bpoint]),col="orange",lty=2) # legend(x=as.POSIXct("2010-01-01"), y=max(stat)+3, legend=c("1% cv" , "5% cv", "10% cv"), # col=c("red", "blue", "seagreen"),xjust=1, yjust=1, lty=1, # horiz=TRUE, cex=0.66, bty="n") #plot(y,main=colnames(y),ylab="",xlab="");grid() #abline(v=time(y[output$bpoint,]),col="orange",lty=2)
Computes the Gauss-Weierstrass window to obtain consistent estimate of long-run variance of multivariate time series.
gw(data,v)gw(data,v)
data |
Data matrix for computing consistent long-run variance, normally, multivariate regression residuals. |
v |
Number of autocovariance terms in the kernel. |
amat |
Return the consistent estimate of long-run variance. This procedure handles both multivariate and single time series, which is basically designed for "fmvar","fmgmm" and "fmols". |
weights |
The weights vector, used by function |
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University.
Brillinger, David R. (1981) Time Series Data Analysis and Theory. San Francisco, CA: Holden-Day.
data(macro) e=apply(macro, 2, function(x) x-mean(x)) gw(e,v=15)data(macro) e=apply(macro, 2, function(x) x-mean(x)) gw(e,v=15)
Implement the KPSS unit root test for the null of I(0) stationarity. The test type as deterministic component is specified as x, see example below.
kpss(y, x, lags = c("short", "long", "nil"), use=c("nw","ba"))kpss(y, x, lags = c("short", "long", "nil"), use=c("nw","ba"))
y |
Vector to be tested for a unit root. |
x |
data matrix for deterministic component. For example a vector of one for intercept, or trend. The default is "x=NULL", which is the same of a vector of one |
lags |
Lags used for correction of error term. |
use |
User specified lags for correction of error term. See section |
lags="short" sets the number of lags to , whereas lags="long" sets the number of lags to
. If lags="nil" is choosen, no error correction is made.
Furthermore, "lags" and "use" are mutually exclusive: As long as "use" is not NULL, its argument will be chosen first. One can specify a different number of maximum lags by setting "use" accordingly. Users can input number of your souce. This version suports two bandwidth functions: "nw" for Newey-West and "and" for Andrews. The kernel functions are supported: "ba"=Bartlett, "pa"=Parzen, "qs"=Qudratic Spectral
teststat |
The KPSS test statistic. |
cval |
Critical values. |
lag |
Number of lags used for kernel function. |
resid |
Regression residuals. |
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University.
Kwiatkowski, D., Phillips, P.C.B., Schmidt, P. and Shin, Y. (1992) Testing the Null Hypothesis of Stationarity Against the Alternative of a Unit Root: How Sure Are We That Economic Time Series Have a Unit Root? Journal of Econometrics, 54,159-178.
Phillips, P.C.B. and Sainan Jin (2002) The KPSS test with seasonal dummies. Economics Letters, 77, 239-243.
data(macro) y=macro[,"INF"] const=rep(1,nrow(y)) trend=seq(nrow(y))/nrow(y) D=cbind(const,trend) #seasonal dummies can be specified here KPSS=kpss(y,x=D,lags = c("short", "long", "nil")[2], use=c("nw","ba")) # If argument use isn't NULL, the argument "lags" will be ignored. KPSS$teststat KPSS$cval KPSS$lag kpss(y,x=D,lags = c("short", "long", "nil")[2],use=15) kpss(y,x=D, lags = c("short", "long", "nil")[2], use=NULL) #if "use=NULL", argument "lags" will be chosen as input.data(macro) y=macro[,"INF"] const=rep(1,nrow(y)) trend=seq(nrow(y))/nrow(y) D=cbind(const,trend) #seasonal dummies can be specified here KPSS=kpss(y,x=D,lags = c("short", "long", "nil")[2], use=c("nw","ba")) # If argument use isn't NULL, the argument "lags" will be ignored. KPSS$teststat KPSS$cval KPSS$lag kpss(y,x=D,lags = c("short", "long", "nil")[2],use=15) kpss(y,x=D, lags = c("short", "long", "nil")[2], use=NULL) #if "use=NULL", argument "lags" will be chosen as input.
Implement the Kurozumi (2002) sequential kpss test with one structural break.
kpss_1br(y, lags = c("short", "long", "nil"), model=c("intercept","both"), use=c("nw","ba"), trim=0.1)kpss_1br(y, lags = c("short", "long", "nil"), model=c("intercept","both"), use=c("nw","ba"), trim=0.1)
y |
Vector to be tested for a unit root. |
lags |
Lags used for correction of error term. |
model |
Modelling where the unknown structural change occurs. |
use |
User specified lags for correction of error term. The default is the lag determined by Newey-West bandwidth "nw" with Bartlett "ba" kernel. Users can input your own number. This version suports two bandwidth functions: "nw" for Newey-West, "and" for Andrews. Three kernel functions are supported by both bandwidth functions: "ba"=Bartlett, "pa"=Parzen, "qs"=Qudratic Spectral |
trim |
The trimming percentage. Default is 10 |
lags="short" sets the number of lags to
, whereas
lags="long" sets the number of lags to
. If lags="nil" is choosen, then no error correction is made. Furthermore, lags and use are mutually exclusive. As long as use is not set to be NULL, its argumenta will be chosen fisrt.
One can specify a different number of maximum lags by setting use accordingly.
teststat |
The kpss test statistic with one structural break. |
cval |
Critical values. |
bpoint |
The breaking point that corresponds to the teststat. |
tstats |
The sequential KPSS test statistic. |
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University.
Kwiatkowski, D., Phillips, P.C.B., Schmidt, P. and Shin, Y. (1992) Testing the Null Hypothesis of Stationarity Against the Alternative of a Unit Root: How Sure Are We That Economic Time Series Have a Unit Root? Journal of Econometrics, 54, 159-178.
Kurozumi, E. (2002) Testing for stationarity with a break. Journal of Econometrics,108(1), 105-127.
Phillips, P.C.B. and Sainan Jin (2002) The KPSS test with seasonal dummies. Economics Letters, 77, 239-243.
data(macro) y=macro[,"INF"] KPSS1=kpss_1br(y,model=c("intercept","both")[2],use=c("nw","ba")) KPSS1$teststat KPSS1$cval y[KPSS1$bpoint,] #Plot plot.ts(KPSS1$tstats,ylim=range(c(KPSS1$tstats,KPSS1$cval)));grid() abline(h=KPSS1$cval[1],col="red") abline(h=KPSS1$cval[2],col="blue") abline(h=KPSS1$cval[3],col="green") abline(v=KPSS1$bpoint,col="red",lty=2)data(macro) y=macro[,"INF"] KPSS1=kpss_1br(y,model=c("intercept","both")[2],use=c("nw","ba")) KPSS1$teststat KPSS1$cval y[KPSS1$bpoint,] #Plot plot.ts(KPSS1$tstats,ylim=range(c(KPSS1$tstats,KPSS1$cval)));grid() abline(h=KPSS1$cval[1],col="red") abline(h=KPSS1$cval[2],col="blue") abline(h=KPSS1$cval[3],col="green") abline(v=KPSS1$bpoint,col="red",lty=2)
Implement the kpss unit root test with two unknown structural breaks. Carrion-i-Silvestre and Sanso (2007) extends Kurozumi (2002) to two breaks, and create critical values.
kpss_2br(y, lags = c("short", "long", "nil"), model=1, use=c("nw","ba"),trace=TRUE)kpss_2br(y, lags = c("short", "long", "nil"), model=1, use=c("nw","ba"),trace=TRUE)
y |
Vector to be tested for a unit root. |
lags |
Lags used for correction of error term. |
model |
Modelling where the unknown structural change occurs. |
use |
User specified lags for correction of error term. The default is the lag determined by Newey-West bandwidth "nw" with Bartlett "ba" kernel. Users can input your own number. This version suports two bandwidth functions: "nw" for Newey-West, "and" for Andrews. Three kernel functions are supported by both bandwidth functions: "ba"=Bartlett, "pa"=Parzen, "qs"=Qudratic Spectral |
trace |
Logical. If TURE (default), then screen displays the sequential progress. |
lags="short" sets the number of lags to
, whereas
lags="long" sets the number of lags to
. If lags="nil" is choosen, then no error correction is made. Furthermore, lags and use are mutually exclusive. As long as use is not set to be NULL, its argumenta will be chosen fisrt.
One can specify a different number of maximum lags by setting use accordingly.
teststat |
The test statistic. |
cval |
The critical values that are tabulated in Carrion-i-Silvestre and Sanso, A. (2007). |
bpoint1 |
The first breaking point that corresponds to the teststat. |
bpoint2 |
The second breaking point that corresponds to the teststat. |
timeElapse |
Time elapsed for sequential search. |
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University.
Carrion-i-Silvestre, J. L. and Sanso, A. (2006) A guide to the computation of stationarity tests. Empirical Economics, 31(2), 433-448.
Carrion-i-Silvestre, J. L. and Sanso, A. (2007) The KPSS test with two structural breaks,Spanish Economic Review, 9(2), 105-127.
Kwiatkowski, D., Phillips, P.C.B., Schmidt, P. and Shin, Y. (1992) Testing the Null Hypothesis of Stationarity Against the Alternative of a Unit Root: How Sure Are We That Economic Time Series Have a Unit Root? Journal of Econometrics, 54, 159-178.
Kurozumi, E. (2002) Testing for stationarity with a break. Journal of Econometrics,108(1), 105-127.
data(macro) y=macro[1:200,"INF"] KPSS2=kpss_2br(y,model=1,use=c("nw","ba")) KPSS2$teststat KPSS2$cval y[KPSS2$bpoint,]data(macro) y=macro[1:200,"INF"] KPSS2=kpss_2br(y,model=1,use=c("nw","ba")) KPSS2$teststat KPSS2$cval y[KPSS2$bpoint,]
Compute the Bartlett kernel proposed by Kurozumi (2002) to obtains consistent estimate of long-run variance.
Kurozumi_Bartlett(e)Kurozumi_Bartlett(e)
e |
data that needs to compute consistent long-run variance, normally, regression residuals |
Return the consistent estimate of long-run variance, Bartlett kernel proposed by Kurozumi (2002).
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University.
Kurozumi, E. (2002) Testing for stationarity with a break. Journal of Econometrics,108(1), 105-127.
data(macro) y=macro[,"INF"] e=y-mean(y) Kurozumi_Bartlett(e)data(macro) y=macro[,"INF"] e=y-mean(y) Kurozumi_Bartlett(e)
Compute the Quadratic Spectral kernel proposed by Kurozumi (2002) to obtains consistent estimate of long-run variance.
Kurozumi_QS(e)Kurozumi_QS(e)
e |
data that needs to compute consistent long-run variance, normally, regression residuals. |
Return the consistent estimate of long-run variance, Quadratic Spectral kernel proposed by Kurozumi (2002).
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University.
Kurozumi, E. (2002) Testing for stationarity with a break. Journal of Econometrics,108(1), 105-127.
data(macro) y=macro[,"INF"] e=y-mean(y) Kurozumi_QS(e)data(macro) y=macro[,"INF"] e=y-mean(y) Kurozumi_QS(e)
Computes the modified Dirichlet window to obtain consistent estimate of long-run variance of multivariate time series.
mdchlet(data,v)mdchlet(data,v)
data |
Data matrix for computing consistent long-run variance, normally, multivariate regression residuals. |
v |
Number of autocovariance terms in the kernel. |
amat |
Return the consistent estimate of long-run variance. This procedure handles both multivariate and single time series, which is basically designed for "fmvar","fmgmm" and "fmols". |
weights |
The weights vector, used by function |
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University.
Brillinger, David R. (1981) Time Series Data Analysis and Theory. San Francisco, CA: Holden-Day.
data(macro) e=apply(macro, 2, function(x) x-mean(x)) mdchlet(e,v=15)data(macro) e=apply(macro, 2, function(x) x-mean(x)) mdchlet(e,v=15)
Compute the Parzen window to obtain consistent estimate of long-run variance of multivariate time series.
parzen(data,v)parzen(data,v)
data |
Data matrix for computing consistent long-run variance, normally, multivariate regression residuals. |
v |
Number of autocovariance terms in the kernel. |
amat |
Return the consistent estimate of long-run variance. This procedure handles both multivariate and single time series, which is basically designed for "fmvar","fmgmm" and "fmols". |
weights |
The weights vector, used by function |
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University.
Brillinger, David R. (1981) Time Series Data Analysis and Theory. San Francisco, CA: Holden-Day.
data(macro) e=apply(macro, 2, function(x) x-mean(x)) parzen(e,v=15)data(macro) e=apply(macro, 2, function(x) x-mean(x)) parzen(e,v=15)
Compute the Parzen kernel to obtain consistent estimate of long-run variance.
Parzen_uni(e,v)Parzen_uni(e,v)
e |
A univariate time series for computing consistent long-run variance, normally, regression residuals. |
v |
Number of lag terms used to compute the long-run variance. |
Return the consistent estimate of long-run variance, that PP and KPSS tests require. This procedure handles single time series only.
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University.
Brillinger, David R. (1981) Time Series Data Analysis and Theory. San Francisco, CA: Holden-Day.
data(macro) y=macro[,"INF"] e=y-mean(y) Parzen_uni(e,v=15)data(macro) y=macro[,"INF"] e=y-mean(y) Parzen_uni(e,v=15)
Implement the Phillips-Perron (1988) PP unit root test, including both Za (Z-alpha) and Zt (Z-tau) statistics. This wrapper allows inputting additional deterministic part, for example season dummies, but the asymptotic critical values are not available.
pp(y,type=c("none","const","trend"),d=NULL,lags=c("short","long","nill"),use=c("nw","ba"))pp(y,type=c("none","const","trend"),d=NULL,lags=c("short","long","nill"),use=c("nw","ba"))
y |
Vector to be tested for a unit root. |
type |
The deterministic parts in the test regression. |
d |
Additional deterministic parts in addition to "type"" in the test regression. |
lags |
Lags used for correction of error term. See section "details" below. |
use |
User specified lags for correction of error term. See section "details" below.The default is the lag determined by Newey-West bandwidth ("nw") with Bartlett kernel ("ba"). |
lags="short" sets the number of lags to
, whereas
lags="long" sets the number of lags to
. If lags="nil" is choosen, no error correction is made.
Furthermore, "lags" and "use" are mutually exclusive: As long as "use" is not set to be NULL, its argument will be chosen first. One can specify a different number of maximum lags by setting "use" accordingly. Users can input number of your souce. This version suports two bandwidth functions: "nw" for Newey-West and "and" for Andrews. The kernel functions are supported: "ba"=Bartlett, "pa"=Parzen, "qs"=Qudratic Spectral
Zt |
The Z-tau test statistic. |
cvZt |
Critical values of Zt. |
Za |
The Z-alpha test statistic. |
cvZa |
Critical values of Za. |
lag |
Number of lags used for kernel function. |
resid |
Regression residuals. |
This code modifies function ur.pp of package urca, which does not have relevant critical values for "Z-alpha" test statistic.
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University.
Phillips, P.C.B. and Perron, P. (1988) Testing for a unit root in time series regression. Biometrika, 75(2), 335-346.
MacKinnon, J.G. (1991) Critical Values for Cointegration Tests- Long-Run Economic Relationships, eds. R.F. Engle and C.W.J. Granger, London, Oxford, 267-276.
data(macro) y=macro[,"INF"] pp(y, type=c("none","const","trend")[3], lags = c("short", "long", "nil")[2], use=c("nw","ba")) # If argument "use" is NOT NULL, argument lags will be ignored. pp(y,lags = c("short", "long", "nil")[2], type=c("none","const","trend")[3], use=NULL) pp(y,lags = c("short", "long", "nil")[2], type=c("none","const","trend")[3], use=18)data(macro) y=macro[,"INF"] pp(y, type=c("none","const","trend")[3], lags = c("short", "long", "nil")[2], use=c("nw","ba")) # If argument "use" is NOT NULL, argument lags will be ignored. pp(y,lags = c("short", "long", "nil")[2], type=c("none","const","trend")[3], use=NULL) pp(y,lags = c("short", "long", "nil")[2], type=c("none","const","trend")[3], use=18)
Computes the Andrews (1991) Quadratic-Spectral window to obtain consistent estimate of long-run variance of multivariate time series.
qs(data,v)qs(data,v)
data |
Data matrix for computing consistent long-run variance, normally, multivariate regression residuals. |
v |
Number of autocovariance terms in the kernel. |
amat |
Return the consistent estimate of long-run variance. This procedure handles both multivariate and single time series, which is basically designed for "fmvar","fmgmm" and "fmols". |
weights |
The weights vector, used by function |
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University.
Andrews, D. W. K. (1991) Heteroskedasticity and Autocorrelation Consistent Covariance Matrix Estimation. Econometrica, 59, 817-858.
Brillinger, David R. (1981) Time Series Data Analysis and Theory. San Francisco, CA: Holden-Day.
data(macro) e=apply(macro, 2, function(x) x-mean(x)) qs(e,v=15)data(macro) e=apply(macro, 2, function(x) x-mean(x)) qs(e,v=15)
Compute the QS kernel to obtain consistent estimate of long-run variance.
QS_uni(e,v)QS_uni(e,v)
e |
A univariate time series for computing consistent long-run variance, normally, regression residuals. |
v |
Number of lag terms used to compute the long-run variance. |
Return the consistent estimate of long-run variance, that PP and KPSS tests require. This procedure handles single time series only.
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University.
Brillinger, David R. (1981) Time Series Data Analysis and Theory. San Francisco, CA: Holden-Day.
data(macro) y=macro[,"INF"] e=y-mean(y) QS_uni(e,v=15)data(macro) y=macro[,"INF"] e=y-mean(y) QS_uni(e,v=15)
Computes the Reisz Bochner window to obtain consistent estimate of long-run variance of multivariate time series.
reisz(data,v)reisz(data,v)
data |
Data matrix for computing consistent long-run variance, normally, multivariate regression residuals. |
v |
Number of autocovariance terms in the kernel. |
amat |
Return the consistent estimate of long-run variance. This procedure handles both multivariate and single time series, which is basically designed for "fmvar","fmgmm" and "fmols". |
weights |
The weights vector, used by function |
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University.
Brillinger, David R. (1981) Time Series Data Analysis and Theory. San Francisco, CA: Holden-Day.
data(macro) e=apply(macro, 2, function(x) x-mean(x)) reisz(e,v=15)data(macro) e=apply(macro, 2, function(x) x-mean(x)) reisz(e,v=15)
Compute the Bartlett kernel proposed by Sul, Phillips and Choi (2003) to obtains consistent estimate of long-run variance.
SPC_Bartlett(e,v)SPC_Bartlett(e,v)
e |
data that needs to compute consistent long-run variance, normally, regression residuals. |
v |
Number of lag terms to use when computing the long-run variance. |
Return the consistent estimate of long-run variance, Bartlett kernel proposed by Sul, Phillips and Choi (2003) .
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University.
Carrion-i-Silvestre, J. L. and Sanso, A. (2006) A guide to the computation of stationarity tests.Empirical Economics, 31(2), 433-448.
Carrion-i-Silvestre, J. L. and Sanso, A. (2007) The KPSS test with two structural breaks. Spanish Economic Review, 9(2), 105-127.
Sul, D., Phillips, P.C.B., and Choi, C.Y.(2005) Prewhitening Bias in HAC Estimation. Oxford Bulletin of Economics and Statistics, 67(4), 517-546.
data(macro) y=macro[,"INF"] e=y-mean(y) SPC_Bartlett(e,v=15)data(macro) y=macro[,"INF"] e=y-mean(y) SPC_Bartlett(e,v=15)
Compute the Quadratic Spectral kernel of Sul, Phillips and Choi (2003) to obtains consistent estimate of long-run variance.
SPC_QS(e,v)SPC_QS(e,v)
e |
data that needs to compute consistent long-run variance, normally, regression residuals. |
v |
Number of lag terms to use when computing the long-run variance. |
Return the consistent estimate of long-run variance.
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University.
Carrion-i-Silvestre, J. L. and Sanso, A. (2006) A guide to the computation of stationarity tests.Empirical Economics, 31(2), 433-448.
Carrion-i-Silvestre, J. L. and Sanso, A. (2007) The KPSS test with two structural breaks. Spanish Economic Review, 9(2), 105-127.
Sul, D., Phillips, P.C.B., and Choi, C.Y.(2005) Prewhitening Bias in HAC Estimation. Oxford Bulletin of Economics and Statistics, 67(4), 517-546.
data(macro) y=macro[,"INF"] e=y-mean(y) SPC_QS(e,v=15)data(macro) y=macro[,"INF"] e=y-mean(y) SPC_QS(e,v=15)
Computes Stock and Watson (1988) common trends statistic for the null hypothesis that the data is a noncointegrated system (after allowing for a p-th order polynomial time trend).
sw(data,p,v=15,ker_fun="parzen",aband=0,filter=0)sw(data,p,v=15,ker_fun="parzen",aband=0,filter=0)
data |
Matrix of k-time series variables. |
p |
Order of the time polynomial in the null hypothesis. |
v |
Number of autocovariance terms to compute the spectrum at frequency zero, default=15. |
ker_fun |
Set kernel function to one of the available kernels, default="parzen". See section |
aband |
Whether to activate the automatic bandwidth selection. |
filter |
Whether to use an AR(1) filter to compute the spectrum at frequency zero. |
1. Available kernels. Technical details are referred to Brillinger (1981,P.55)
"parzen"=Parzen kernel
"fejer"=Bartlett kernel
"dchlet"= Dirichlet kernel
"mdchlet"= Modified Dirichlet kernel
"tukham"=Tukey-Hamming kernel
"tukhan"=Tukey-Hanning kernel
"cauchy"=Cauchy kernel
"bohman"=Bohman kernel
"reisz"=Riesz,Bochner kernel
"gw"= Gauss-Weierstrass kernel
"qs"= Andrews (1991) Quadratic-Spectral
These kernels are written for FM procedures, technically different from those used in pp and kpss tests.
2. Andrews (1991) has developed data based (or automatic) bandwidth procedures for computing the spectrum. COINT implements these procedures for the Parzen, Bartlette, Tukey-Hamming, and the Quadratic-Spectral kernels. When aband is active, COINT ignores the value you specify for the band-width parameter and automatically substitutes the data-based value.
3. The aim of the AR(1) filter is to flatten the spectrum of residual around the zero frequency, thereby making it easier to estimate the true spectrum by simple averaging of the periodogram.
sw_stat |
Test statistic. Reject the null of a unit root if the SW statistic < critical value |
sw_cv |
Critical values. |
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University.
Stock, J. & M. K. Watson (1988) Testing for Common Trends. Journal of the American Statistical Association, 83, 1097-1107.
data(macro) sw(macro,p=1,v=15)data(macro) sw(macro,p=1,v=15)
Compute the Tukey-Hamming window to obtain consistent estimate of long-run variance of multivariate time series.
tukham(data,v)tukham(data,v)
data |
Data matrix for computing consistent long-run variance, normally, multivariate regression residuals. |
v |
Number of autocovariance terms in the kernel. |
amat |
Return the consistent estimate of long-run variance. This procedure handles both multivariate and single time series, which is basically designed for "fmvar","fmgmm" and "fmols". |
weights |
The weights vector, used by function |
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University.
Brillinger, David R. (1981) Time Series Data Analysis and Theory. San Francisco, CA: Holden-Day.
data(macro) e=apply(macro, 2, function(x) x-mean(x)) tukham(e,v=15)data(macro) e=apply(macro, 2, function(x) x-mean(x)) tukham(e,v=15)
Compute the Tukey-Hanning window to obtain consistent estimate of long-run variance of multivariate time series.
tukhan(data,v)tukhan(data,v)
data |
Data matrix for computing consistent long-run variance, normally, multivariate regression residuals. |
v |
Number of autocovariance terms in the kernel. |
amat |
Return the consistent estimate of long-run variance. This procedure handles both multivariate and single time series, which is basically designed for "fmvar","fmgmm" and "fmols". |
weights |
The weights vector, used by function |
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University.
Brillinger, David R. (1981) Time Series Data Analysis and Theory. San Francisco, CA: Holden-Day.
data(macro) e=apply(macro, 2, function(x) x-mean(x)) tukhan(e,v=15)data(macro) e=apply(macro, 2, function(x) x-mean(x)) tukhan(e,v=15)
Compute Phillips' (1987) Za and Zt statistics for the null hypothesis that y has a unit root.
Za(y,p=1,v=15,ker_fun="parzen",aband=0,filter=0)Za(y,p=1,v=15,ker_fun="parzen",aband=0,filter=0)
y |
The data of dependent variable in a regression. |
p |
Order of the time polynomial in the cointegrating regressio. |
v |
Number of autocovariance terms to compute the spectrum at frequency zero, default=15. |
ker_fun |
Set kernel function to one of the available kernels, default="parzen". See section |
aband |
Whether to activate the automatic bandwidth selection. |
filter |
Whether to use an AR(1) filter to compute the spectrum at frequency zero. |
alpha |
Estimate of the AR(1) coefficient. |
za |
Za statistic for the series under the null has a unit root. Reject the null hypothesis of a unit root if the test statistic < critical value. |
za_cv |
Critical values of Za. |
zt |
Zt statistic for the series under the null has a unit root. Reject the null hypothesis of a unit root if the test statistic < critical value. |
zt_cv |
Critical values of Zt. |
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University.
Ouliaris, S., J. Y. Park, and P. C. B. Phillips (1989) Testing for a Unit Root in the Presence of a Maintained Trend. Ch. 1 in Baldev Raj (ed.), Advances in Econometrics and Modelling. Netherlands: Kluwer Academic Publishers.
Phillips, P. C. B. (1987) Time Series Regression with a Unit Root. Econometrica, 55, 277-301.
data(macro) y=macro[,1] Za(y,p=1,v=10)data(macro) y=macro[,1] Za(y,p=1,v=10)
This function implements Zivot-Andrews sequential ADF unit root test with unknown one structural break. Handling two outlier models: "Innovational outlier" and "Additive outlier".
ZA_1br(y, model=c("intercept", "trend", "both"), outlier=1, pmax=8, ic=c("AIC","BIC"), fixed=FALSE, trim=0.1, eq=1, season=FALSE)ZA_1br(y, model=c("intercept", "trend", "both"), outlier=1, pmax=8, ic=c("AIC","BIC"), fixed=FALSE, trim=0.1, eq=1, season=FALSE)
y |
Univariate time series data, a preferable format is |
model |
Modelling where the unknown structural change occurs. |
outlier |
The outlier model. |
pmax |
The maximal lags that are either included in the test regression or lag selection searches its optimal lag via "ic". |
ic |
Information criteria, "AIC" or "BIC". The default is "AIC". |
fixed |
Logical. If TURE, pmax is the fixed inputed lags. If FALSE, pmax is the maximal lags where lag selection searches its optimal lag. |
trim |
The trimming percentage. Default is 10 |
eq |
The type of dependent variable in ADF equation. |
season |
Logical. If TURE,then seasonal dummies will be included in the test regression. |
teststat |
The Zivot-Andrews test statistic, which is the |
cval |
The critical values that are tabulated in Zivot and Andrews(1992) |
p |
The number of lags that are included in the test regression. |
bpoint |
The breaking point that corresponds to the teststat. |
tstats |
The sequential ADF test statistic. |
testreg |
The |
timeElapse |
Time elapsed for sequential search. |
This code modifies function ur.za of package urca. We add "season", "eq", "outlier",and "trim".
Specifically, "outlier" is crucial, "season" is left to advanced research.
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University.
Zivot,E. and Andrews, W.K. (1992) Further Evidence on the Great Crasch, the Oil-Price Shock, and the Unit-Root Hypothesis. Journal of Business & Economic Statistics,10(3), 251-270.
data(macro) #US inflation rate, 1958M1-2025M7 y=macro[1:200,"INF"] za1=ZA_1br(y, ic=c("AIC","BIC")[2], outlier=1, pmax=8, fixed=TRUE, model=c("intercept","trend","both")[1], trim=0.01, eq=1, season=TRUE) za1$timeElapse[3] za1$teststat za1$cval y[za1$bpoint,] za1$tstats za1$p #plotting plot.ts(za1$tstats,ylim=range(c(za1$tstats,za1$cval))) abline(h=za1$cval[1],col="red") abline(h=za1$cval[2],col="blue") abline(h=za1$cval[3],col="green") abline(v=za1$bpoint,col="red",lty=2)data(macro) #US inflation rate, 1958M1-2025M7 y=macro[1:200,"INF"] za1=ZA_1br(y, ic=c("AIC","BIC")[2], outlier=1, pmax=8, fixed=TRUE, model=c("intercept","trend","both")[1], trim=0.01, eq=1, season=TRUE) za1$timeElapse[3] za1$teststat za1$cval y[za1$bpoint,] za1$tstats za1$p #plotting plot.ts(za1$tstats,ylim=range(c(za1$tstats,za1$cval))) abline(h=za1$cval[1],col="red") abline(h=za1$cval[2],col="blue") abline(h=za1$cval[3],col="green") abline(v=za1$bpoint,col="red",lty=2)
This function implements Zivot-Andrews sequential ADF unit root test with one unknown structural break. Handling two outlier models: "Innovational outlier" and "Additive outlier".
ZA_2br(y, model=c("intercept", "both"), pmax=8, ic=c("AIC","BIC"), fixed=TRUE, trim=0.1, eq=1, trace=TRUE, season=FALSE)ZA_2br(y, model=c("intercept", "both"), pmax=8, ic=c("AIC","BIC"), fixed=TRUE, trim=0.1, eq=1, trace=TRUE, season=FALSE)
y |
Univariate time series data, a preferable format is |
model |
Modelling where the unknown structural change occurs. |
pmax |
The maximal lags that are either included in the test regression or lag selection searches its optimal lag via "ic". |
ic |
Information criteria, "AIC" or "BIC". The default is "AIC". |
fixed |
Logical. If TURE, pmax is the fixed inputed lags, and the default is TRUE. |
trim |
The trimming percentage. Default is 10 |
eq |
The type of dependent variable in ADF equation. |
trace |
Logical. If TURE, then screen displays the sequential progress. |
season |
Logical. If TURE,then seasonal dummies will be included in the test regression, and y must be in |
This code entends Zivot-Andrews (1992) sequential procedure to two unknown structural changes. Critical values are from Narayan and Popp (2010).
teststat |
The ADF test statistic in the presence of two structural breaks. |
cval |
The critical values that are tabulated in Narayan and Popp (2010). |
p |
The number of lags that are included in the test regression. |
bpoint1 |
The first breaking point that corresponds to the teststat. |
bpoint2 |
The second breaking point that corresponds to the teststat. |
timeElapse |
Time elapsed for sequential search. |
This code modifies function ur.za of package urca. We add "season", "eq", "outlier",and "trim".
Specifically, "outlier" is crucial, "season" is left to advanced research.
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University.
Narayan, P. K. and Popp, S. (2010) A new unit root test with two structural breaks in level and slope at unknown time.
Journal of Applied Statistics,37, 1425-1438.
Zivot,E. and Andrews, W.K. (1992),Further Evidence on the Great Crasch, the Oil-Price Shock, and the Unit-Root Hypothesis. Journal of Business & Economic Statistics,10(3), 251-270.
data(macro) # US macro data, 1967M1-2025M7 # It takes time y=macro[1:200,"INF"] za2=ZA_2br(y, ic=c("AIC","BIC")[2], pmax=8, fixed=TRUE, model=c("intercept","trend","both")[1], trim=0.1, eq=1, season=FALSE) za2$timeElapse[3]/60 za2$teststat za2$cval y[za2$bpoint1,] #The first dated strictural change y[za2$bpoint2,] #The second dated strictural changedata(macro) # US macro data, 1967M1-2025M7 # It takes time y=macro[1:200,"INF"] za2=ZA_2br(y, ic=c("AIC","BIC")[2], pmax=8, fixed=TRUE, model=c("intercept","trend","both")[1], trim=0.1, eq=1, season=FALSE) za2$timeElapse[3]/60 za2$teststat za2$cval y[za2$bpoint1,] #The first dated strictural change y[za2$bpoint2,] #The second dated strictural change