plot.visreg2d | R Documentation |
Plot method for visualizing how two variables interact to affect the response in regression models.
## S3 method for class 'visreg2d'
plot(
x,
plot.type = c("image", "persp", "rgl", "gg"),
xlab,
ylab,
zlab,
color,
print.cond = FALSE,
whitespace = 0.2,
...
)
x |
A |
plot.type |
The style of plot to be produced. The following options are supported:
|
xlab |
Axis label for x variable |
ylab |
Axis label for y variable |
zlab |
Axis label for outcome |
color |
For |
print.cond |
If |
whitespace |
When |
... |
Graphical parameters can be passed to the function to customize the plots. |
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/surface.html, visreg()
fit <- lm(Ozone ~ Solar.R + Wind + Temp + I(Wind^2) + I(Temp^2) +
I(Wind*Temp)+I(Wind*Temp^2) + I(Temp*Wind^2) + I(Temp^2*Wind^2),
data=airquality)
visreg2d(fit, x="Wind", y="Temp", plot.type="image")
visreg2d(fit, x="Wind", y="Temp", plot.type="image",
color=c("purple", "green", "red"))
visreg2d(fit, x="Wind", y="Temp", plot.type="persp")
## Requires the rgl package
visreg2d(fit,x="Wind",y="Temp",plot.type="rgl")
## Requires the ggplot2 package
visreg2d(fit, x="Wind", y="Temp", plot.type="gg")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.