predscor {classmap} | R Documentation |
Draws a predictions correlation plot, which visualizes the correlations between the prediction terms in a regression fit.
Description
Computes the correlations between the prediction terms in a regression fit, and displays them graphically in a way that takes the standard deviations of the prediction terms into account. The input variables of the regression can be numerical, categorical, logical and character, and the regression model can be linear or generalized linear. The regression formula in lm
or glm
may contain transformations and interactions.
Usage
predscor(fit, maxnpreds = 8, sort.by.stdev = TRUE, adj.order = FALSE,
cell.length = "stdev", plot.abs.cor = FALSE, palette = NULL,
diagonalcolor = "black")
Arguments
fit |
|
maxnpreds |
the maximal number of prediction terms to plot. When there are more prediction terms than this, those with smallest standard deviations are combined. |
sort.by.stdev |
if |
adj.order |
if |
cell.length |
if " |
plot.abs.cor |
if |
palette |
a vector with colors to display
correlations ranging from -1 to 1.
If |
diagonalcolor |
color of the cells on the diagonal of the correlation matrix. The default is "black". |
Value
A list containing
cormat |
the correlation matrix of the prediction terms. |
predterms |
matrix of cases by prediction terms. |
predsummary |
data frame with the standard deviation of each prediction term and the total linear prediction. |
Author(s)
Rousseeuw, P.J.
References
Rousseeuw, P.J. (2025). Explainable Linear and Generalized Linear Models by the Predictions Plot https://arxiv.org/abs/2412.16980v2 (open access).
See Also
Examples
data(data_titanic)
attach(data_titanic)
Pclass = factor(Pclass, unique(Pclass))
Sex = factor(Sex, labels = c("F","M"))
fit <- glm(y ~ Sex + Age + SibSp + Parch + Pclass, family=binomial)
predscor(fit)
# For more examples, we refer to the vignette:
## Not run:
vignette("predsplot_examples")
## End(Not run)