Learn R Programming

car (version 1.0-2)

subsets: Plot Output from regsubsets Function in leaps package

Description

The regsubsets function in the leaps package finds optimal subsets of predictors. This function plots a measure of fit (see the statistic argument below) against subset size).

Usage

subsets(object, ...)

subsets.regsubsets(object, 
    names=abbreviate(object$xnames, minlength = abbrev), 
    abbrev=1, min.size=1, max.size=length(names), legend, 
    statistic=c("bic", "cp", "adjr2", "rsq", "rss"), 
    las=par('las'), cex.subsets=1, ...)

Arguments

object
a regsubsets object produced by the regsubsets function in the leaps package.
names
a vector of (short) names for the predictors, excluding the regression intercept, if one is present; if missing, these are derived from the predictor names in object.
abbrev
minimum number of characters to use in abbreviating predictor names.
min.size
minimum size subset to plot; default is 1.
max.size
maximum size subset to plot; default is number of predictors.
legend
TRUE to plot a legend of predictor names; defaults to TRUE if abbreviations are computed for predictor names. The legend is placed on the plot interactively with the mouse.
statistic
statistic to plot for each predictor subset; one of: "bic", Bayes Information Criterion; "cp", Mallows's $C_{p}$; "adjr2", $R^{2}$ adjusted for degrees of freedom; "rsq", unadjusted
las
if 0, ticks labels are drawn parallel to the axis; set to 1 for horizontal labels (see par).
cex.subsets
can be used to change the relative size of the characters used to plot the regression subsets; default is 1.
...
arguments to be passed down to subsets.regsubsets and plot.

Value

  • NULL. This function is used for its side effect -- to create a plot.

See Also

regsubsets

Examples

Run this code
library(leaps)
data(Ericksen)
subsets(regsubsets(undercount ~ ., data=Ericksen))

Run the code above in your browser using DataLab