Fits a generalized linear mixed model with site-level random intercepts using
only one-shot per-site summaries (Ck, Sk, S2k, X0). Each of the
iterations constructs weighted LMM summary statistics which are then solved
by lmm.fit (from DLMM), yielding updated fixed effects and random
intercepts until convergence.
cola_glmm(
summary_by_site,
family = "poisson",
intercept = TRUE,
beta_init = NULL,
u_init = NULL,
max_iter = 50,
tol = 1e-06,
verbose = TRUE
)A list with elements:
beta: named fixed-effect estimates
u: named site random-intercept BLUPs
V: variance component matrix for the random intercept
s2: residual scale from the working LMM
iter: number of iterations performed
SiXYZ_last: last iteration's sufficient statistics (by site)
Named list of site summaries. Each element must contain
Ck, Sk, S2k, and X0 as returned by
generate_CSU_site. The list names should be site IDs.
Character; one of "poisson" or "binomial"
(canonical links).
Logical; whether the fixed-effect design includes an
intercept (affects how X0 was constructed). Default TRUE.
Optional named numeric vector of initial fixed effects. Defaults to zeros.
Optional named numeric vector of initial site random effects (one per site). Defaults to zeros.
Integer maximum number of IRLS iterations. Default 50.
Convergence tolerance on relative squared parameter change.
Default 1e-6.
Logical; print iteration progress. Default TRUE.
Uses canonical links: log for Poisson and logit for binomial. The fixed-effect
covariates in X0 are assumed binary (plus optional Intercept).
For numerically extreme logits, a small weight floor is used internally.
Requires lmm.fit from dlmm.R to be on the search path.
# fit <- cola_glmm(summary_by_site, family = "poisson")
Run the code above in your browser using DataLab