plot.visreg | R Documentation |
A function for visualizing regression models quickly and easily. Default
plots contain a confidence band, prediction line, and partial residuals.
Factors, transformations, conditioning, interactions, and a variety of other
options are supported. The plot.visreg()
function accepts a visreg
or visregList
object as calculated by visreg()
and creates the plot.
## S3 method for class 'visreg'
plot(
x,
overlay = FALSE,
print.cond = FALSE,
whitespace = 0.2,
partial = identical(x$meta$trans, I),
band = TRUE,
rug = ifelse(partial, 0, 2),
strip.names = is.numeric(x$fit[, x$meta$by]),
legend = TRUE,
top = c("line", "points"),
gg = FALSE,
line.par = NULL,
fill.par = NULL,
points.par = NULL,
...
)
x |
A |
overlay |
By default, when |
print.cond |
If |
whitespace |
When |
partial |
If |
band |
If |
rug |
By default, partial residuals are plotted. Alternatively, a
|
strip.names |
When |
legend |
For overlay plots, ( |
top |
By default, the fitted line is plotted on top of the partial
residuals; usually this is preferable, but it does run the risk of obscuring
certain residuals. To change this behavior and plot the partial residuals on
top, specify |
gg |
By default ( |
line.par |
List of parameters (see |
fill.par |
List of parameters (see |
points.par |
List of parameters ( |
... |
Graphical parameters can be passed to the function to customize
the plots. If |
Patrick Breheny and Woodrow Burchett
Breheny P and Burchett W. (2017) Visualization of regression models using visreg. R Journal, 9: 56-71. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.32614/RJ-2017-046")}
https://pbreheny.github.io/visreg/articles/options.html, visreg()
,
visreg2d()
fit <- lm(Ozone ~ Solar.R + Wind + Temp,data=airquality)
visreg(fit, "Wind", line=list(col="red"), points=list(cex=1, pch=1))
## Changing appearance
visreg(fit, "Wind", line=list(col="red"), points=list(cex=1, pch=1))
## See ?visreg and https://pbreheny.github.io/visreg for more examples
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.