Learn R Programming

tsDyn (version 0.7-60)

TVECM.HStest: Test of linear cointegration vs threshold cointegration

Description

Tests the null of linear cointegration against threshold cointegration following Hansen and Seo (2002). Fixed regressor anfd residual bootstrap are available.

Usage

TVECM.HStest(data, lag=1, ngridTh=300, trim=0.05, nboot=100, fixed.beta=NULL,  intercept=TRUE, boot.type=c("FixedReg", "ResBoot"), hpc=c("none", "foreach"))

Arguments

data
Time series
lag
Number of lags to include in each regime
ngridTh
Number of threshold points to estimate
trim
Trimming parameter indicating the minimal percentage of observations in each regime
nboot
Number of bootstrap replications
fixed.beta
Numeric. User pre-specified cointegrating value. When NULL (default), the value is estimated from the linear VECM.
intercept
Logical. Whether an intercept has to be included in the VECM
boot.type
Character. Type of bootstrap simulation (only if nboot>0)
hpc
Possibility to run the bootstrap on parallel core. See details

Value

  • A list cointaining diverse values:
  • statThe sup-LM statistic.
  • valuesThe whole LM values.
  • PvalBootThe bootstrap p-value
  • CriticalValBootThe bootstrap critical values
  • allBootsThe boot sup-LM values
  • argsSome user given args (nboot, boot.type)

Reproducibility

Comparison with original paper is made difficult as values of the test are not shown in the paper, only their critical values, whihc depend on random bootstrap.

Comparison is done with the GAUSS code available on the page of Bruce Hansen. Running tar_ci, we have the same sup-LM value when lags=1 and lags=2, a higher value with lag=3. When the test is run with pre-specified beta values, we have different results, sometimes higher but also smaller sup-LM value.

Details

This test follows the implementation done by Hansen and Seo (2002). The cointegrating value is estimated from the linear VECM. Then, conditional on this value, the LM test is run for a range of different threshold values. The maximum of those LM test values is reported.

Two bootstrap are available: a fixed regressor, as well as a usual residual bootstrap (using the function TVECM.sim).

Available methods are print(), summary() and plot().

With the argument hpc, the burdensome bootstrap replication can be run on parallel cores, thus alleviating the time of computation. The user needs simply to choose a package (among doMC, doMPI, doSNOW or doRedis) and register the backend. See the vignette for more details.

References

Hansen, B. and Seo, B. (2002), Testing for two-regime threshold cointegration in vector error-correction models, Journal of Econometrics, 110, pages 293 - 318

See Also

TVECM.SeoTest: a similar test, but with null hypothesis of no-cointegration. TVECM for estimating a TVECM, TVECM.sim for simulating/bootstrap a TVECM,

Examples

Run this code
#Use original data from paper:
data(zeroyld)
dataPaper<-zeroyld
# Test: nboot, number of bootstrap replications, should be high 
test1<-TVECM.HStest(dataPaper, lag=1, intercept=TRUE, nboot=1000)

#we use here for the example a much smaller number of bootstrap:
test1<-TVECM.HStest(dataPaper, lag=1, intercept=TRUE, nboot=10)

test1
summary(test1)
plot(test1)

#can have only specific plots:
plot(test1, which="LM values")
plot(test1, which="Density")

## Run the function in parallel:
#we show here the use with package doMC
library(doMC)
registerDoMC(2) #Number of cores
test1<-TVECM.HStest(dataPaper, lag=1, intercept=TRUE, nboot=1000, hpc="foreach")

Run the code above in your browser using DataLab