bestlm | R Documentation |
bestlm
performs an exhaustive search for the best subsets of the variables in ind
for predicting dip
in linear regression.
bestlm (dip, ind, kmax=4, nbest=3)
## S3 method for class 'bestlm'
print(x, ...)
## S3 method for class 'bestlm'
summary(object, ...)
x |
object of class |
object |
object of class |
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 |
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.
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;
For information on the package and the Author, and for all the references, see nsRFA
.
lm
, REGRDIAGNOSTICS
.
data(hydroSIMN)
bestlm(parameters[,"Dm"], parameters[,-c(1:2)])
regr <- lm(Dm ~ Am + S2000 + NORD, parameters); regr
summary(regr)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.