getBestModel: Get the best model with nvar variables, or by AIC, BIC or...

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

View source: R/getBestModel.R

Description

Returns a binary vector of variables 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
getBestModel(mogavs, nvar, method = c("AIC", "BIC", "knee", "mse", NULL))

Arguments

mogavs

A model of the class mogavs.

nvar

Number of variables for the best model. Only used if method is mse or NULL. Can be omitted if method is named and is AIC, BIC or knee.

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 mse or NULL means that the function looks for the best model with nvar variables and the lowest mean square error.

Value

A binary vector of the variables in the best model.

Author(s)

Tommi Pajala <tommi.pajala@aalto.fi>

See Also

getBestModelVars

Examples

1
2
3
4
data(sampleData)
mod<-mogavs(y~.,data=sampleData,maxGenerations=20)
getBestModel(mod,15,"mse")
getBestModel(mod,method="BIC")

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