Skip to content
Back to formatted view

Raw Message

Message-ID: <BANLkTi=mzbErGwpWMrbLxWUc+ShPkfsu4w@mail.gmail.com>
Date: 2011-05-18T16:37:59Z
From: Hasan Diwan
Subject: strucchange package Linux help

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