k_var_model {iBART}R Documentation

Best subset selection for linear regression

Description

Best subset selection for linear regression

Usage

k_var_model(
  X_train,
  y_train,
  X_test = NULL,
  y_test = NULL,
  k = 1,
  parallel = FALSE
)

Arguments

X_train

The design matrix used during training.

y_train

The response variable used during training.

X_test

The design matrix used during testing. Default is X_test = NULL and full data will be used to train the best subset linear regression model.

y_test

The response variable used during testing. Default is y_test = NULL and full data will be used to train the best subset linear regression model.

k

The maximum number of predictors allowed in the model. For example, k = 5 will produce the best model 5 predictors.

parallel

Logical flag for parallelization. Default is parallel = FALSE.

Value

A list of outputs.

models

An lm object storing the best k-predictor linear model.

names

The variable name of the best k predictors.

rmse_in

In-sample RMSE of the model.

rmse_out

Out-of-sample RMSE of the model.


[Package iBART version 1.0.0 Index]