TVECM.HStest: Test of linear cointegration vs threshold cointegration

View source: R/TVECM.HStest.R

TVECM.HStest R Documentation

Test of linear cointegration vs threshold cointegration

Description

Tests the null of linear cointegration against threshold cointegration following Hansen and Seo (2002). Fixed regressor and 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 grid points to evaluate the optimal threshold.

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, as in VECM (i.e. cointegrating vector will be c(1, -beta.fixed)). 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

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.

Value

A list containing diverse values:

stat

The sup-LM statistic.

values

The whole LM values.

PvalBoot

The bootstrap p-value

CriticalValBoot

The bootstrap critical values

allBoots

The boot sup-LM values

args

Some 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, which 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.

Author(s)

Matthieu Stigler

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

zeroyld: data used in the original paper of Hansen and Seo.

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

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

## End(Not run)

#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:
## Not run: 
#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")

## End(Not run)


tsDyn documentation built on Feb. 16, 2023, 6:57 p.m.