partialResp | R Documentation |
This function produces partial response plot(s) for probability or favourability, for one to all variables in a 'glm' model object.
partialResp(model, vars = NULL, Fav = FALSE, se.mult = 1.96, plot.points = FALSE,
ylim = c(0, 1), reset.par = TRUE, ...)
model |
a model object of class 'glm' and family 'binomial'. |
vars |
character vector of the name(s) of the variable(s) for which to compute the partial response plot. The default is |
Fav |
logical value indicating whether to compute the response curve(s) for |
se.mult |
numeric value indicating the multiplier for the standard error of the predictions. The default is 1.96, for the 95% confidence interval. If set to 0, no confidence intervals are plotted. |
plot.points |
logical value indicating whether to plot the points of predicted probability (or favourability, if |
ylim |
either a numeric vector of length 2 indicating the minimum and maximum value for the y-axis, or character value |
reset.par |
logical. If TRUE (the default), plotting |
... |
some additional arguments that can be passed to |
Each variable is plotted at intervals of 1/100th of its range. Confidence intervals are computed as the value plus/minus the standard error multiplied by 'se.mult' (default 1.96, for the 95% confidence interval). To avoid the confidence intervals exceeding the 0:1 interval that's possible for probability, the standard error is computed on the predictions at the scale of the predictors (i.e., computed with type="link"
), and then back-transformed with model$family$linkinv
(see https://fromthebottomoftheheap.net/2018/12/10/confidence-intervals-for-glms – thanks to Gavin Simpson for this post!).
A partial response plot for each variable.
A. Marcia Barbosa
plotmo::plotmo
, predicts::partialResponse
data(rotif.env)
form <- reformulate(names(rotif.env)[5:17], "Kcochl")
mod <- glm(form, data = rotif.env, family = binomial)
partialResp(mod)
partialResp(mod, Fav = TRUE)
partialResp(mod, Fav = TRUE, plot.points = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.