[R] strucchange package Linux help

Hasan Diwan hasan.diwan at gmail.com
Wed May 18 18:37:59 CEST 2011


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



More information about the R-help mailing list