[R] Plotting issues with -par(mfrow=c(r,c))- after -boot-

Jeff Newmiller jdnewmil at dcn.davis.CA.us
Sun Jun 1 23:07:26 CEST 2014


Read ?plot.boot, in particular the Side Effects section. Not a very friendly function... you will have to modify it if you wish to proceed.
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.

On June 1, 2014 1:20:45 PM PDT, Clive Nicholas <clivelists at googlemail.com> wrote:
>R 3.1.0 / RStudio 0.98.507 / OpenSUSE Linux 13.1
>
>I'm having difficulties getting -par(mfrow=c(r,c))- to work as it
>should
>after running bootstrapped regression models using -boot-. An example
>(tested):
>
>test=data.frame(A=rnorm(500, mean=2.72, sd=5.36),
>B=sample(c(12,20,24,28,32),size=500,prob=c(0.333,0.026,0.026,0.436,0.179),replace=TRUE),
>C=sample(c(0,1),size=500,prob=c(0.5,0.5),replace=TRUE),D=sample(c(0,1),size=500,prob=c(0.564,0.436),replace=TRUE))
>library(boot)
>bs=function(formula, data, indices) {
> test=data[indices,]
> fit=lm(formula, data=test)
> return(coef(fit))
>}
>results=boot(data=test, statistic=bs, R=10000, formula=A~B+C+D+C*D)
>results
>
>When I run
>
>par(mfrow=c(2,2))
>
>and then
>
>plot(results, index=2)
>plot(results, index=3)
>plot(results, index=4)
>plot(results, index=5)
>
>the plots display in full size only, as they are called, and not as one
>combined image of four plots. This problem also happened to me last
>year
>under earlier versions of R in Kubuntu Linux.
>
>This command worked fine when I first started using R in Linux, I don't
>think I'm doing much wrong in this instance and I would welcome any
>explanation as to what exactly is going on here, as well as a solution.



More information about the R-help mailing list