glm.best: Title: Fitting generalized linear models for the best model

View source: R/fit_glm.R

glm.bestR Documentation

Title: Fitting generalized linear models for the best model

Description

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

Usage

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

Arguments

object

the model selection result from modelselect.glm.

family

a character string naming a family function describing the error distribution to be used in the model.

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 "glm", which is a list containing the following components:

coefficients

a named vector of coefficients.

residuals

the working residuals, that is the residuals in the final iteration of the IWLS fit.

fitted.values

the fitted mean values, obtained by transforming the linear predictors by the inverse of the link function.

rank

the numeric rank of the fitted linear model.

family

the family object used.

linear.predictors

the linear fit on the link scale.

deviance

up to a constant, minus twice the maximized log-likelihood.

aic

A version of Akaike's An Information Criterion, minus twice the maximized log-likelihood plus twice the number of parameters, computed by the aic component of the family.

null.deviance

The deviance for the null model, comparable with deviance. The null model will include the offset, and an intercept if there is one in the model.

iter

the number of iterations of IWLS used.

weights

the working weights, that is the weights in the final iteration of the IWLS fit.

prior.weights

the weights initially supplied, a vector of 1s if none were.

df.residual

the residual degrees of freedom.

df.null

the residual degrees of freedom for the null model.

y

if requested, the response vector used.

converged

logical. Was the IWLS algorithm judged to have converged?

boundary

logical. Is the fitted value on the boundary of the allowable values?

model

if requested (the default), the model frame used.

call

the matched call.

formula

the formula supplied.

terms

the terms.object used.

data

the data argument.

threshold

the threshold used for method = "variables".


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