compare_predictors | R Documentation |
This function fits a set of models to the data, where each model includes only one predictor. It then fits a full model with all predictors. The function returns a data frame with the coefficients for each model, as well as the full model. Thus, if given p predictors, it will return p+1 model results and 2 betas for each predictor.
compare_predictors(
data,
outcome,
predictors,
additional_models = NULL,
conf.level = 0.95,
family = gaussian
)
data |
The data frame to use |
outcome |
The name of the outcome variable. Must be numeric. |
predictors |
A character vector of predictors to use. |
additional_models |
A list of additional models to fit. Each element of the list should be a character vector of predictors to use. The names of the list will be used as the model names in the output. |
conf.level |
The confidence level to use. Default is .95. |
family |
The family to use. Default is "gaussian" (OLS), see |
A data frame with the coefficients for each model
compare_predictors(iris, names(iris)[1], names(iris)[-1])
compare_predictors(mpg, names(mpg)[3], names(mpg)[-3])
#with additional models
compare_predictors(iris, names(iris)[1], names(iris)[-1], additional_models = list(petal = c("Petal.Length", "Petal.Width")))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.