| RealInt {bcp} | R Documentation |
US ex-post real interest rate: the three-month treasury bill deflated by the CPI inflation rate.
data("RealInt")
A quarterly time series from 1961(1) to 1986(3).
The data is available online in the data archive of the Journal of Applied Econometrics. url: http://qed.econ.queensu.ca/jae/2003-v18.1/bai-perron/.
Bai J., Perron P. (2003), Computation and Analysis of Multiple Structural Change Models, Journal of Applied Econometrics, 18, 1-22.
Achim Zeileis, Friedrich Leisch, Bruce Hansen, Kurt Hornik, Christian Kleiber (2006), The strucchange Package, version 1.3-1, CRAN: The Comprehensive R Network.
##### RealInt #####
data("RealInt")
bcp.ri <- bcp(as.vector(RealInt))
summary.bcp(bcp.ri)
plot.bcp(bcp.ri)
# to see bcp and Bai and Perron results run:
if(require("strucchange")) {
bcp.ri$posterior.prob[length(bcp.ri$posterior.brob)] <- 0
bp <- breakpoints(RealInt ~ 1, h = 2)$breakpoints
rho <- rep(0, length(RealInt))
rho[bp] <- 1
b.num<-1 + c(0,cumsum(rho[1:(length(rho)-1)]))
bp.mean <- unlist(lapply(split(RealInt,b.num),mean))
bp.ri <- rep(0,length(RealInt))
for(i in 1:length(bp.ri)) bp.ri[i] <- bp.mean[b.num[i]]
op <- par(mfrow=c(2,1),col.lab="black",col.main="black")
xax <- seq(1961, 1987, length=103)
plot(xax, bcp.ri$posterior.mean, type="l", xlab="Time", ylab="Mean", main="Posterior Means")
lines(xax, bp.ri, col="blue")
points(RealInt)
plot(xax, bcp.ri$posterior.prob, type="l", ylim=c(0,1), xlab="Time", ylab="Posterior Probability", main="Posterior Probability of a Change")
for(i in 1:length(bp.ri)) abline(v=xax[bp[i]], col="blue")
par(op)
} else {
cat("strucchange is not loaded")
}