When I run the code below on Macintosh and Windows, the plot comes out
fine. However, on Linux, the png generated is invalid from R console,
and loading strucchange crashes rkward. Is this a known issue on Linux
and, if so, is there a workaround? Many thanks!
require(strucchange)
data("RealInt")
bp.ri <- breakpoints(RealInt~1, h=15)
summary(bp.ri)
fac.ri <- breakfactor(bp.ri, breaks = 3, label='seg')
fm.ri <- lm(RealInt~0 + fac.ri)
summary(fm.ri)
vcov.ri <- function(x,...) kernHAC (x, kernel = 'Quadratic Spectral',
prewhite = 1, approx = 'AR(1)', ...)
coef(bp.ri, breaks <- 3)
sapply(vcov(bp.ri, breaks = 3, vcov=vcov.ri), sqrt)
confint(bp.ri, breaks = 3, vcov=vcov.ri)

png('SCC2.png')
plot(RealInt)
lines(as.vector(time(RealInt)), fitted(fm.ri), col=4)
lines(confint(bp.ri, breaks = 3, vcov=vcov.ri))
dev.off()
print(paste('Plot in SCC2.png in', getwd()))

-- 
Sent from my mobile device
Envoyait de mon telephone mobil

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to