plot.sm {npreg} | R Documentation |
Plot Effects for Smooth Model Fits
Description
Plots the main and two-way interaction effects for objects of class "sm".
Usage
## S3 method for class 'sm'
plot(x, terms = x$terms, se = TRUE, n = 201, intercept = FALSE,
ask = prod(par("mfcol")) < length(terms) && dev.interactive(),
zero.line = TRUE, zero.lty = 3, zero.col = "black", ncolor = 21,
colors = NULL, rev = FALSE, zlim = NULL, lty.col = NULL,
legend.xy = "top", main = NULL, xlab = NULL, ylab = NULL, ...)
Arguments
x |
a fit from |
terms |
which terms to include in the plot. The default plots all terms. |
se |
a switch indicating if standard errors are required. |
n |
number of points to use for line plots. Note |
intercept |
a switch indicating if an intercept should be added to the effect plot(s). |
ask |
a swith indicating if the user should be prompted before switching plots (if |
zero.line |
a switch indicating if the zero line should be added to the effect plot(s). |
zero.lty |
line type for the zero line (if |
zero.col |
color for the zero line (if |
ncolor |
number of colors to use for image plot(s). |
colors |
colors to use for image plots. Can input the name of a color palette (see |
rev |
if |
zlim |
limits to use for image plot(s) when mapping numbers to colors. |
lty.col |
color(s) to use for lines when plotting effects of continuous predictors. |
legend.xy |
location to place the legend for line plots involving interactions. |
main |
title for plot (ignored unless plotting a single term). |
xlab |
x-axis label for plot (ignored unless plotting a single term). |
ylab |
y-axis label for plot (ignored unless plotting a single term). |
... |
Details
Plots main and two-way interaction effects for fit smooth models using either line or image plots. The terms
arugment can be used to plot a specific effect term. Main and interaction effects are plotted by creating predictions from the fit model that only include the requested terms (see predict.sm
), and then using either the plotci
function (for line plots) or the image
function (for heatmaps).
Value
Produces a line or image plot for each requested term in the model.
Note
Three-way interaction effects are not plotted.
Author(s)
Nathaniel E. Helwig <helwig@umn.edu>
References
Helwig, N. E. (2020). Multiple and Generalized Nonparametric Regression. In P. Atkinson, S. Delamont, A. Cernat, J. W. Sakshaug, & R. A. Williams (Eds.), SAGE Research Methods Foundations. https://doi.org/10.4135/9781526421036885885
See Also
sm
for fitting sm
objects.
Examples
# see examples in sm() help file
?sm