bestlm {nsRFA}R Documentation

Subsets regression

Description

bestlm performs an exhaustive search for the best subsets of the variables in ind for predicting dip in linear regression.

Usage

 bestlm (dip, ind, kmax=4, nbest=3)
 ## S3 method for class 'bestlm':
 print (x, ...)
 ## S3 method for class 'bestlm':
 summary (object, ...)

Arguments

x object of class bestlm, output of function bestlm
object object of class bestlm, output of function bestlm
dip vector n x 1 of dependent variable to be predicted
ind matrix n x K of the K independent variables (candidate predictors)
kmax maximum size (number of regressors) to report
nbest number of subsets of each size to report
... other arguments

Details

This function has been obtained using the function leaps of the R package leaps. It is based on the Alan Miller's FORTRAN routines.

Warning: the function will stop with an error if ind is not of full rank or if it has more than 31 columns.

Value

bestlm returns the following values:
subselect matrix (kmax*nbest)x(ncol(ind)) with the sets of chosen linear models, ordered in function of the adjusted coefficient of determination (R2adj);
R2adj the ordered adjusted coefficient of determination;

Note

For information on the package and the Author, and for all the references, see nsRFA.

See Also

lm, REGRDIAGNOSTICS.

Examples

data(hydroSIMN)

bestlm(parameters[,"Dm"], parameters[,-c(1:2)])

regr <- lm(Dm ~ Am + S2000 + NORD, parameters); regr
summary(regr)

[Package nsRFA version 0.6-7 Index]