bestmods: Find best submodels of a full linear model

Description Usage Arguments Details Value Author(s) See Also Examples

Description

This function inputs a table of models produced by scoremods, picks out the best models according to a specified information criterion, and (optionally) generates a graphical representation of these models.

Usage

1
2
3
4
5
bestmods(tbl, ic = "AIC", nmods = 10, plot = TRUE, 
         labels = dimnames(tbl)[[2]][1:attr(tbl,"npred")], 
         cex.axis = 1, las = 2 - all(labels==1:attr(tbl,"npred")), 
         xlab = if (las==1) "Predictors" else "",  
         ylab = "Criterion value", main = ic, ...)

Arguments

tbl

a table of the kind outputted by scoremods.

ic

the information criterion used to score the models. By default, this is "eic". "AIC", "AICc" and "CVIC" are also available.

nmods

maximum number of lowest-scoring models to retain.

plot

logical value indicating whether to plot the criterion values for the best models.

labels

labels for the predictors, used along the horizontal axis of the plot.

cex.axis, las, xlab, ylab, main

graphical parameters for the plot; see par.

...

additional graphical parameters passed to plot.

Details

Only models with criterion value equal to or less than that of the null (intercept-only) model are retained, even if there are fewer than nmods such models. If the null model is among the best nmods models and plot = TRUE, the plot includes a dotted line representing the null model.

The defaults for las and labels are intended to make the horizontal axis look sensible, whether or not names for the predictors are provided in tbl. See the example below.

Value

A table consisting of the rows of tbl referring to the models with lowest value of criterion ic.

Author(s)

Philip Reiss phil.reiss@nyumc.org and Lei Huang huangracer@gmail.com

See Also

scoremods

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
data(swiss)
modtable = scoremods(swiss$Fertility, swiss[ , -1], nboot=100)

par(mfrow = 1:2)
bestmods(modtable)

# The predictor names may render the above table too wide to be 
# read easily.  To remove them, set names = 1:5 in the above call 
# to scoremods.  Alternatively, modify modtable as follows:
modtable.nonames = modtable
dimnames(modtable.nonames)[[2]][1:5] = 1:5
bestmods(modtable.nonames, main="Same, minus names")

reams documentation built on May 2, 2019, 2:23 p.m.