Runs an IRLS loop with Beta working responses/weights and calls
glmnet on the weighted least-squares surrogate. Supports BIC/AIC/CV
model choice and an optional prestandardize speedup. The helper uses only
the mean submodel, requires complete cases, and does not expose offset terms.
Usage
betareg_glmnet(
X,
Y,
alpha = 1,
choose = c("bic", "aic", "cv"),
nfolds = 5,
n_iter = 6,
tol = 1e-05,
standardize = TRUE,
lambda = NULL,
phi_init = 20,
update_phi = TRUE,
phi_maxit = 5,
prestandardize = FALSE,
trace = FALSE
)Arguments
- X
Numeric matrix (n × p) of mean-submodel predictors.
- Y
Numeric response in (0,1). Values are squeezed to (0,1) internally.
- alpha
Elastic-net mixing parameter.
- choose
One of
"bic","aic", or"cv"to picklambda.- nfolds
Folds for CV when
choose = "cv".- n_iter
Max IRLS iterations;
- tol
Convergence tolerance for the IRLS parameter change (Euclidean norm of the difference in
[a0, beta]), default1e-5.- standardize
Forwarded to
glmnet(ignored ifprestandardize = TRUE).- lambda
Optional fixed lambda; if
NULL, chosen bychoose.- phi_init
Initial precision (phi).
- update_phi
Logical; update phi inside the IRLS loop.
- phi_maxit
Newton steps for phi update.
- prestandardize
If
TRUE, manually center/scaleXonce and disableglmnet's internal standardization (speed trick).- trace
Logical; print IRLS progress.