Learn R Programming

ham (version 1.2.0)

plot.importance: Plot of variable importance ranked by partial chi-square statistic

Description

Plots an importance class object. Produces a dot chart that places the predictor variable with the highest partial chi-square (Wald chi-square for individual coefficients) at the bottom. It is a metric of the partial chi-square minus its degrees of freedom (Harrell, 2015). Predictor variables with significant p-values at the 0.05 alpha are highlighted red. Consider graphical parameters of mar=c(4.2, 2, 3.5, 3) and oma = c(0, 0, 0, 3).

Usage

# S3 method for importance
plot(
  x,
  y,
  main = NULL,
  cex = NULL,
  pt.cex = NULL,
  pch = NULL,
  color = NULL,
  lcolor = NULL,
  ...
)

Value

plot of variable importance, significant variables highlighted in red.

Arguments

x

importance object.

y

not currently used.

main

overall title for the plot, default is 'Variable Importance'.

cex

the character size to be used. Setting cex to a value smaller than 1 can be a useful way of avoiding label overlap. This sets the actual size, not a multiple of par('cex').

pt.cex

the cex to be applied to plotting symbols, default is 2.

pch

the plotting character or symbol to be used, default is 19.

color

the color to be used for points and labels when there are significant results. Default is 'red'.

lcolor

the color(s) to be used for the horizontal lines. Default is 'gray'.

...

additional arguments.

References

Harrell, F. E., Jr. (2016). Regression Modeling Strategies. Springer International Publishing. ISBN: 978-3-319-19424-0.

Examples

Run this code
# OLS regression
plot(importance(assess(mpg ~ hp + wt + cyl, data=mtcars, regression= "ols")$model))

# logistic regression
plot(importance(assess(vs~mpg+wt+hp, data=mtcars, regression= "logistic")$model))

Run the code above in your browser using DataLab