subsetBIC: Unified BIC-style Objective for Subset Selection (GLM &...

View source: R/gareg_subset.R

subsetBICR Documentation

Unified BIC-style Objective for Subset Selection (GLM & Gaussian)

Description

Computes a BIC-like criterion for a chromosome that encodes a variable subset. The same expression

\mathrm{BIC} = n \log(\mathrm{rss\_like}/n) + k \log n

is used for all families, where:

  • For Gaussian with identity link, rss_like is the residual sum of squares (RSS), computed via a fast .lm.fit.

  • For other GLM families, rss_like is the residual deviance from glm.fit.

The effective parameter count k includes the intercept.

Usage

subsetBIC(
  subset_bin,
  y,
  X,
  family = stats::gaussian(),
  weights = NULL,
  offset = NULL,
  control = stats::glm.control()
)

Arguments

subset_bin

Integer/numeric 0–1 vector (length ncol(X)); 1 means the corresponding column of X is included in the model.

y

Numeric response vector of length n.

X

Numeric matrix of candidate predictors; columns correspond to variables.

family

A GLM family object (default stats::gaussian()).

weights

Optional prior weights (passed to glm.fit).

offset

Optional offset (passed to glm.fit).

control

GLM fit controls; default stats::glm.control().

Details

The chromosome subset_bin is a binary vector (0/1 by column), indicating which predictors from X are included. The design matrix always includes an intercept. Rank-deficient selections return Inf (which the GA maximizer treats as a very poor score). The value returned is -BIC so that GA engines can maximize it.

Value

A single numeric value: -BIC. Larger is better for GA maximizers. Returns Inf for rank-deficient designs.

See Also

glm.fit, glm.control, .lm.fit


GAReg documentation built on March 29, 2026, 5:08 p.m.