[R] strucchange package Linux help
Achim Zeileis
Achim.Zeileis at uibk.ac.at
Wed May 18 19:34:19 CEST 2011
On Wed, 18 May 2011, Hasan Diwan wrote:
> 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.
I can replicate nothing of this. I ran the script both in a plain R 2.13.0
and in RKward 0.5.5 on a Debian GNU/Linux machine.
In both cases, the script below yielded the correct outcome and the PNG
showed the correct graphic. (And neither R or RKward crashed.)
> Is this a known issue on Linux and, if so, is there a workaround?
This is almost certainly no general Linux problem with PNG graphics and no
problem with the specific strucchange example. It's more likely that
something else goes wrong in your specific setup.
Z
> 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 at 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.
>
More information about the R-help
mailing list