TAR_CI.R
##  To estimate and test a threshold bi-variate VECM
## 
##  written by:
##  
##  Bruce E. Hansen
##  Department of Economics
##  Social Science Building
##  University of Wisconsin
##  Madison, WI 53706-1393
##  
behansen@wisc.edu
##  http://www.ssc.wisc.edu/~bhansen/
##  
##  and 
##  
##  Byeongseon Seo
##  Department of Economics
##  Soongsil University
##  Seoul, 156-743
##  Korea
##  
seo@saint.soongsil.ac.kr
##  
##  
##  This R program estimates a bi-variate VECM, a threshold bi-variate VECM, and
##  tests for the presence of a threshold.  The methods are those described in
##  "Testing for Threshold Cointegration" by Bruce E. Hansen and Byeongseon Seo.
##  
##  The program is set up to replicate the empirical application to the 3-month 
##  and 6-month interest rates series.  For your own application, load your data 
##  into the matrix "dat", and change the controls listed below
##  
###########################################################################
# Controls #
k <- 1              # Lags in VAR beyond EC 
gn <- 300              # number of gridpoints for gamma 
bn <- 300                # number of gridpoints for beta      
trim <- .05                # trimming percentage for threshold 
boot <- 5000        # number of bootstrap replications 
                      # set equal to zero to not do testing  
coint <- 1                # set to 1 to estimate cointegrating vector
                        # set to 0 to fix cointegrating vector at _cvalue 
cvalue <- 1                # cointegrating vector, if coint=0 
cov <- 1                # covariance matrix estimation method
                      # set to 1 for Eicker-White
                      # set to 0 for conventional homoskedastic estimator 
p_ests <- 1       # set to 1 to print estimates, else 0 
graph <- 1        # set to 1 to generate graph of nonlinear ECM, else 0 
graph_rotate <- 0        # set to 1 to generate rotated graphs 
                      # (useful for some print jobs, but ackward for screen viewing) 
# Load your own data into matrix "dat" #
# Here we load in the 3-month and 6-month T-Bill series #
dat <- read.table("zeroyld.dat")
dat <- dat[1:nrow(dat),(7:62)]
rs <- rbind(as.matrix(seq(0,18,1)),21,24,30,as.matrix(seq(36,(36+7*12),12)))
short <- 12
long <- 120
short_i <- which.max(rs==short)
long_i <- which.max(rs==long)
dat <- dat[,cbind(long_i,short_i)]   
来自于Hansen and seo(2002),此程序用来做门槛检验,原程序及数据见附件3,具体的是想知道文中红色字体的程序表示的是什么意思。万分感谢!