Skip to contents

Applies a single‐effect model to each column of a predictor matrix using either GLM (via IRLS + truncated‐L1) or Cox partial likelihood (via penalized IRLS).

Arguments

X

Numeric matrix (n × p) of predictors. Each column is fit separately.

y

Response:

  • For GLMs: numeric vector of length n.

  • For Cox: numeric matrix with 2 columns (time, status) and n rows.

family

A stats::family object (e.g. gaussian(), binomial(), poisson()) or a Cox family list with family = "cox".

offset

Numeric scalar or vector (length n) giving the linear predictor offset (default: 0).

standardize

Logical: if TRUE, center and scale each predictor column before fitting (default: TRUE).

shrinkage

Logical: if TRUE, shrinkage parameters in fitting (default: TRUE).

ties

Character: ties method for Cox partial likelihood ("efron" or "breslow", default: "efron").

lambda

Numeric penalty weight; if ≤ 0, defaults to \(\sqrt{2\log(n)/n}\) (default: 0.0).

tau

Numeric truncation parameter; if ≤ 0, defaults to 1.0 (default: 1.0).

alpha

level of significance

Value

A list of length p, where each element is itself a list with components:

loglik

Unpenalized log‐likelihood at the fitted coefficient.

bic

Bayesian Information Criterion: \(-2*logLik + 2\log(n)\).

bic_diff

BIC difference from null model.

bf

Bayes factor.

pmp

Posterior model probability.

intercept

Estimated intercept for that predictor.

theta

Estimated coefficient for that predictor.

pval_intercept

P-value for estimated intercept for that predictor.

pval_theta

P-value for estimated coefficient for that predictor.

expect_intercept

Expected value of intercept under model averaging.

expect_theta

Expected value of coefficient under model averaging.

expect_variance

Expected variance under model averaging.

Examples

if (FALSE) { # \dontrun{
set.seed(123)
n <- 80; p <- 3
X <- matrix(rnorm(n*p), n, p)
# Gaussian example
y_gauss <- X[,1] * 1.2 + rnorm(n)
res_glm <- single_effect_fit(X, y_gauss, family = gaussian())

# Cox example
times <- rexp(n, rate = exp(0.5 * X[,2]))
status <- rbinom(n, 1, 0.7)
y_cox <- cbind(time=times, status=status)
res_cox <- single_effect_fit(X, y_cox, family = list(family="cox"))
} # }