# select_pred: Selects a best subset of predictor variables. In metan: Multi Environment Trials Analysis

## Description

Selects among a set of covariates the best set of npred predictors for a given response trait resp based on AIC values.

## Usage

 1 select_pred(.data, resp, covariates = NULL, npred)

## Arguments

 .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 .data, except that in resp are selected. To select specific covariates from .data, use a list of unquoted comma-separated variable names (e.g. traits = c(var1, var2, var3)), an specific range of variables, (e.g. traits = c(var1:var3)), or even a select helper like starts_with("N"). npred An integer specifying the size of the subset of predictors to be selected

## Value

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.

## Author(s)

Tiago Olivoto tiagoolivoto@gmail.com

## Examples

 1 2 3 4 library(metan) mod <- select_pred(data_ge2, resp = PH, npred = 10) mod$predictors mod$AIC

metan documentation built on Nov. 10, 2021, 9:11 a.m.