[R] Plots for lmrob function
David Winsemius
dwinsemius at comcast.net
Fri May 20 21:13:16 CEST 2016
> On May 20, 2016, at 8:28 AM, varin sacha via R-help <r-help at r-project.org> wrote:
>
> Dear R-helpers,
>
> I have fitted a robust regression using lmrob function from robustbase package. I try to get the different plots for diagnostics of residuals and others. I can't get them, a window opens but nothing appears on it (the window remains white, no graph appears) and I get this error messages.
>
>
> Here is a small reproducible example
>
>
> a=c(1231,1415,1256,3242,3121,1567)
> b=c(12,34.3,43.5,23.5,12,54.3)
> c=c(23,56,73,21,34,45)
> d=c(43,11,15,65,76,34)
> library("robustbase")
> fit=lmrob(a~b+c+d)
> plot(fit,plot=all)
>
> Erreur dans plot.new() : attempt to plot on null device
>
> I have an open device :
> dev.cur()
>
> null device
> 1
>
> How can I solve my problem and finally get the different required plots ?
>
>
A "null device" is not going to be of much help. Generally one would have an available interactive device. On a Mac this would be the quartz device:
> dev.cur()
quartz
2
That said I also get a different error. I am running with the 'error' option set to `recover`, so I see only a single plot of the "Robust Standardized residuals" before an error is reported. I intially wondered is this is caused by using such a small dataset for a model when requesting three predictors and an outcome.
> plot(fit,plot=all)
recomputing robust Mahalanobis distances
saving the robust distances 'MD' as part of ‘fit’
Hit <Return> to see next plot:
Error in plot.it && missing(ylim) : invalid 'x' type in 'x && y'
In addition: Warning messages:
1: In plot.window(...) : "plot" is not a graphical parameter
2: In plot.xy(xy, type, ...) : "plot" is not a graphical parameter
3: In axis(side = side, at = at, labels = labels, ...) :
"plot" is not a graphical parameter
4: In axis(side = side, at = at, labels = labels, ...) :
"plot" is not a graphical parameter
5: In box(...) : "plot" is not a graphical parameter
6: In title(...) : "plot" is not a graphical parameter
7: In plot.xy(xy.coords(x, y), type = type, ...) :
"plot" is not a graphical parameter
8: In title(sub = sub.caption, ...) : "plot" is not a graphical parameter
But reducing the model did not cure the error. Only removing `plot=all` was sufficient to get plotting of all five plots. The help page for plot.lmrob does not describe a "plot" parameter.
--
David Winsemius
Alameda, CA, USA
More information about the R-help
mailing list