FitLMSubsets {DBModelSelect}R Documentation

Perform all subsets linear regression

Description

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.

Usage

FitLMSubsets(
  response,
  data,
  intercept = TRUE,
  force_intercept = TRUE,
  cluster = NULL
)

Arguments

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 parallel::makeCluster.

Value

A list of fitted linear models suitable for use with the StandICModelSelect function.

Examples

# 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")

[Package DBModelSelect version 0.2.0 Index]