subReg: Functions for model selection

View source: R/subReg.R

subRegR Documentation

Functions for model selection

Description

Model selection by exhaustive search. All subset regression are evaluated to help choosing the best minimalist model. R in action p 211.

Usage

subReg(formula, data, nbest)

Arguments

formula

The models fit by, e.g., the lm and glm functions specified in a compact symbolic form.

data

data.frame

nbest

number of subsets of each size to record

Value

graphic for best model selection based on Adjusted R-squre

Author(s)

JuG

Examples


form = as.formula("Fertility ~ .")

if(!require('MASS')){install.packages('MASS')}
library('MASS')
fit1 <- lm(form, data = swiss)
stepAIC(fit1,direction = "both")

subReg(form, data=swiss, nbest = 3)

relweights(fit1, col="lightgrey",las=1)


jgodet/utilitR documentation built on May 16, 2024, 12:01 p.m.