Fits a Beta regression with optional joint selection of the mean and
precision (phi) submodels using betareg::betareg(). The routine performs
greedy forward/backward search using the requested information criterion and
returns coefficients aligned with the supplied design matrix. The selectors
currently target the mean submodel only, require complete cases, and do not
expose offsets. Observation weights are passed through to betareg() when
provided.
betareg_step_aic(
X,
Y,
direction = "both",
link = "logit",
link.phi = "log",
type = "ML",
trace = FALSE,
max_steps = NULL,
epsilon = 1e-08,
X_phi = NULL,
direction_phi = c("none", "both", "forward", "backward"),
weights = NULL
)Named numeric vector of length p_mean + p_phi + 1 containing the
intercept, mean coefficients, phi-intercept (prefixed by "phi|"), and
phi coefficients (also prefixed by "phi|"). Non-selected variables have
coefficient 0.
Numeric matrix (n × p) of mean-submodel predictors.
Numeric response in (0,1). Values are squeezed to (0,1) internally.
Stepwise direction for the mean submodel: "both",
"forward", or "backward".
Link for the mean submodel (passed to betareg). Default
"logit".
Link for precision parameter. Default "log".
Likelihood type for betareg, e.g. "ML".
Logical; print stepwise trace.
Integer; maximum number of greedy steps (default p).
Numeric; minimum improvement required to accept a move
(default 1e-8).
Optional matrix of candidate predictors for the precision (phi)
submodel. When direction_phi enables precision updates and X_phi is
NULL, the function reuses X.
Stepwise direction for the precision submodel.
Defaults to "none" (no phi selection). Supported values mirror
direction.
Optional non-negative observation weights passed to
betareg().
betareg::betareg()
set.seed(1)
X <- matrix(rnorm(200), 100, 2);
Y <- plogis(0.5 + X[,1]-X[,2]);
betareg_step_aic(X, Y)
Y <- rbeta(100, Y*20, (1-Y)*20)
betareg_step_aic(X, Y)
Run the code above in your browser using DataLab