add_partial_residuals {gratia} | R Documentation |
Add partial residuals
Description
Add partial residuals
Usage
add_partial_residuals(data, model, ...)
## S3 method for class 'gam'
add_partial_residuals(data, model, select = NULL, partial_match = FALSE, ...)
Arguments
data |
a data frame containing values for the variables used to fit the
model. Passed to |
model |
a fitted model for which a |
... |
arguments passed to other methods. |
select |
character, logical, or numeric; which smooths to plot. If
|
partial_match |
logical; should smooths be selected by partial matches
with |
Examples
load_mgcv()
df <- data_sim("eg1", seed = 1)
df <- df[, c("y", "x0", "x1", "x2", "x3")]
m <- gam(y ~ s(x0) + s(x1) + s(x2) + s(x3), data = df, method = "REML")
## add partial residuals
add_partial_residuals(df, m)
## add partial residuals for selected smooths
add_partial_residuals(df, m, select = "s(x0)")