Learn R Programming

psre (version 0.4)

glmImp: Importace Measure for Generalized Linear Models

Description

Calculates importance along the lines of Greenwell et al (2018) using partial dependence plots.

Usage

glmImp(obj, varname, data, level = 0.95, ci_method = c("perc", "norm"), ...)

Value

A data frame of importance measures with optimal bootstrapped confidence intervals.

Arguments

obj

Model object, must be able to use predict(obj, type="terms").

varname

Character string giving the name of the variable whose importance will be calculated.

data

A data frame used to estiamte the model.

level

Confidence level used for the confidence interval.

ci_method

Character string giving the method for calculating the confidence interval - normal or percentile.

...

Other arguments being passed down to `avg_predictions()` from the marginaleffects package.

References

Greenwell, Brandon M., Bradley C. Boehmke and Andrew J. McCarthy. (2018). “A Simple and Effective Model-Based Variable Importance Measure.” arXiv1805.04755 [stat.ML]

Examples

Run this code
# \donttest{ 
data(gss)
mod <- glm(childs ~ sei10 + sex + educ + age, 
            data=gss, family=poisson)
g_imp1 <- glmImp(mod, "age", gss)
# }

Run the code above in your browser using DataLab