select_pred | R Documentation |
Selects among a set of covariates
the best set of npred
predictors for a given response trait resp
based on AIC values.
select_pred(.data, resp, covariates = NULL, npred)
.data |
A data frame with the response variable and covariates. |
resp |
The response variable. |
covariates |
The covariates. Defaults to NULL. In this case, all
numeric traits in |
npred |
An integer specifying the size of the subset of predictors to be selected |
A list with the following elements:
sel_mod An object of class lm
that is the selected model.
predictors The name of the selected predictors.
AIC The Akaike's Information Criterion for the selected model.
pred_models The Akaike's Information Criterion and the predictors selected in each step.
predicted The predicted values considering the model in
sel_mod
.
Tiago Olivoto tiagoolivoto@gmail.com
library(metan) mod <- select_pred(data_ge2, resp = PH, npred = 10) mod$predictors mod$AIC
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.