lm.best: Title: Fitting linear models for the best model

View source: R/fit_lm.R

lm.bestR Documentation

Title: Fitting linear models for the best model

Description

Description: lm.best is used to fit linear model for the best model provided by modelselect.lm.

Usage

lm.best(object, method = "models", threshold = 0.95, x = FALSE, y = FALSE)

Arguments

object

the model selection result from modelselect.lm.

method

the criteria to do model select. method = "models" selects the best model by the highest posterior probabilities. method = "variables" selects the variables in the best model by the posterior inclusion probabilities which are larger than the threshold.

threshold

The threshold for variable selection. The variables with posterior inclusion probability larger than the threshold are selected in the best model. The default is 0.95.

x, y

logicals. If TRUE the corresponding components (the best model predictor matrix, the response) of the fit are returned.

Value

An object of class "lm", which is a list containing the following components:

coefficients

A named vector of coefficients.

residuals

The residuals, that is the response minus the fitted values.

fitted.values

The fitted mean values.

rank

The numeric rank of the fitted linear model.

df.residual

The residual degrees of freedom.

call

The matched call.

terms

The terms object used.

model

(If requested) the model frame used.

qr

(If requested) the QR decomposition of the design matrix.

xlevels

(If the model formula includes factors) a record of the levels of the factors.

contrasts

(If the model formula includes factors) the contrasts used.

offset

The offset used.

threshold

the threshold used for method = "variables".


VariableSelection documentation built on Feb. 17, 2026, 5:07 p.m.