getBestModelVars: Get variable names of the best model with nvar variables, or...

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

View source: R/getBestModelVars.R

Description

Returns a vector of variable names for the best model, as defined by either the AIC, BIC, or knee-point, or alternatively the best for a given number of variables.

Usage

1
getBestModelVars(mogavs, nvars, data, method=c("AIC","BIC","mse",NULL))

Arguments

mogavs

A model of the class mogavs.

nvars

Number of variables for the best model. Only used if method is NULL or MSE.

data

The used data set.

method

The desired metric for defining the best model. If nvar is omitted, method must be named.

Details

The methods AIC, BIC and knee look at the whole set of tried models, whereas NULL means that the function looks for the best model with $nvar$ variables and the lowest mean square error.

Value

Returns a character vector of the variable names of the best model.

Author(s)

Tommi Pajala <tommi.pajala@aalto.fi>

See Also

getBestModel,plotVarUsage

Examples

1
2
3
4
data(sampleData)
mod<-mogavs(y~.,data=sampleData,maxGenerations=20)
getBestModelVars(mod,nvars=15,sampleData,NULL)
getBestModelVars(mod,nvars=0,data=sampleData,method="BIC")

mogavs documentation built on May 2, 2019, 1 a.m.