Description Usage Arguments Value Author(s) Examples
lmsel
is used to fit linear models with optionally performing variable selection using stepwise regression, lasso or elastic net methods.
1 2 |
formula |
an object of class "formula"; a symbolic description of the model to be fitted. |
data |
an optional data frame, list or environment containg the variables in the model. If not specified, the variables are taken from the current environment. |
varsel |
a method of variable selection to be used. The default is |
criterion |
when |
direction |
the mode of stepwise search, can be one of |
indices |
vector of |
train |
if |
lambda |
quadratic penalty parameter for elastic net. The default value is |
A "lmsel"
object is returned, for which print, plot and summary methods can be used.
Michal Knut 1105406k@student.gla.ac.uk.
1 2 3 4 5 6 7 |
Loading required package: glmnet
Loading required package: Matrix
Loading required package: foreach
Loaded glmnet 2.0-16
Loading required package: elasticnet
Loading required package: lars
Loaded lars 1.2
Call:
lmsel.default(formula = lpsa ~ lcavol + lweight + age + lbph +
svi + lcp + gleason + pgg45, data = prostate, varsel = "lasso",
indices = as.numeric(prostate$train))
Coefficients:
(Intercept) lcavol lweight lbph svi pgg45
-0.413675 0.512577 0.549081 0.072151 0.649625 0.002445
Variable selection method: lasso
Variables rejected: age lcp gleasonCall:
lmsel.default(formula = CompressiveStrength ~ ., data = concrete,
varsel = "step", criterion = "BIC")
Coefficients:
(Intercept) Cement BlastFurnaceSlag FlyAsh
28.99298 0.10541 0.08647 0.06866
Water Superplasticizer Age
-0.21809 0.24031 0.11349
Variable selection method: step
Variables rejected: FineAggregate CoarseAggregate
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.