FitLMSubsets | R Documentation |
Perform linear regression on all subsets of covariates supplied. May be done in parallel if a cluster is supplied. Produces an output suitable for use with the StandICModelSelect
function.
FitLMSubsets(
response,
data,
intercept = TRUE,
force_intercept = TRUE,
cluster = NULL
)
response |
A character string specifying the name of the response variable. |
data |
A dataframe containing a column corresponding to the response variable in addition to columns for each covariate of interest. |
intercept |
A logical indicating whether an intercept term should be considered in models. Defaults to TRUE. |
force_intercept |
A logical indicating whether to force an intercept term into all models if an intercept is desired. Defaults to TRUE. |
cluster |
A cluster created using |
A list of fitted linear models suitable for use with the StandICModelSelect
function.
# example code
# generate some data
data <- data.frame(s = rnorm(200), t = rnorm(200))
data$y <- data$s + rnorm(200)
# perform all subsets regression
model_list <- FitLMSubsets(response = "y", data = data, intercept = TRUE, force_intercept = TRUE)
# perform model selection
model_select <- StandICModelSelect(model_list, IC = "AIC")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.