Skip to contents

Fits the LASER model, representing the coefficient vector as a sum of L sparse "single effects." At each iteration, it cyclically applies single_effect_fit to update one effect while holding the others fixed, then updates the intercept (and dispersion, if applicable), until convergence or max_iter is reached.

Arguments

X

Numeric matrix (n × p) of predictors.

y

Response:

  • For GLMs: numeric vector of length n.

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

L

Integer; number of single effects to include (will be set to min(10, L)).

family

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

standardize

Logical: if TRUE, center and scale each predictor column before 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 0.5 (default: 0.5).

decompose

Logical: if TRUE, decompose the theta in fitting (default: TRUE).

shrinkage

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

alpha

level of significance

tol

Numeric; convergence tolerance on the change in expected log-likelihood (default: 5e-2).

max_iter

Integer; maximum number of coordinate-ascent iterations (default: 100).

Value

A list with components:

niter

Number of iterations performed.

loglik

p × L matrix of univariate log-likelihoods.

expect_loglik

Vector of length niter giving the expected log-likelihood at each iteration.

final_loglik

Expected log-likelihood at convergence.

intercept

Estimated intercept term.

dispersion

Estimated dispersion parameter (for Gaussian/Gamma).

theta

p × L matrix of fitted single-effect coefficients.

pval_intercept

p × L matrix of p-values for fitted single-effect intercepts

pval_theta

p × L matrix of p-values for fitted single-effect coefficients.

pmp

p × L matrix of posterior model probabilities.

bic

p × L matrix of BIC values.

bic_diff

p × L matrix of BIC differences from null.

bf

p × L matrix of Bayes factors.

expect_variance

Length-L vector of PMP-weighted variances.

elapsed_time

Numeric; total computation time in seconds.

Examples

if (FALSE) { # \dontrun{
# Gaussian example with 5 effects
X <- matrix(rnorm(100*20), 100, 20)
y <- rnorm(100)
res <- additive_effect_fit(X, y, L = 5, family = gaussian())

# Cox regression example
times  <- rexp(100)
status <- rbinom(100, 1, 0.5)
y_cox  <- cbind(times, status)
res_cox <- additive_effect_fit(X, y_cox, L = 3,
                               family = list(family = "cox"),
                               ties = "breslow")
} # }