Learn R Programming

DAMisc (version 1.7.2)

impCoef: Plot Variable Importance.

Description

Builds a plot of importance based on Silber, Rosenbaum and Ross's (1995) idea of importance as the variance of the predicted model terms.

Usage

impCoef(obj, pct = FALSE, names = NULL, orderSize = TRUE)

Arguments

obj

Any objct that permits prediction of model terms using the predict(obj, type="terms") syntax.

pct

Logical indicating whether the entries should be percentagized by the total sum of squares in the predictions.

names

An optional vector of names for the coefficients.

orderSize

Logical indicating whether the terms are ordered by importance in the graph.

Value

Returns an initialized ggplot, but geometries need to be added to produce meaningful output (see examples).

References

Silber, JH, PR Rosenbaum and RN Ross (1995) Comparing the Contributions of Groups of Predictors: Which Outcomes Vay with Hospital Rather than Patient Characteristics? JASS 90, 7-18.

Examples

Run this code
# NOT RUN {
data(aclp)
library(ggplot2)
mod <- glm(democ ~ log(gdpw) + popg +  year, data=aclp, family=binomial)	
impCoef(mod, pct=TRUE, names=c("GDP", "Population", "Year")) + 
geom_point(size=2)  +
labs(x="Importance", y="")


# }

Run the code above in your browser using DataLab