GHansen | R Documentation |
Conduct the cointegration analysis with regime shifts, proposed by Gregory-Hansen (1996A).
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 <tsungwu@ntnu.edu.tw>, 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:300,1]
x=macro[1:300,-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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.