Skip to contents

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.

Usage

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
)

Arguments

X

Numeric matrix (n × p) of mean-submodel predictors.

Y

Numeric response in (0,1). Values are squeezed to (0,1) internally.

direction

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".

type

Likelihood type for betareg, e.g. "ML".

trace

Logical; print stepwise trace.

max_steps

Integer; maximum number of greedy steps (default p).

epsilon

Numeric; minimum improvement required to accept a move (default 1e-8).

X_phi

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.

direction_phi

Stepwise direction for the precision submodel. Defaults to "none" (no phi selection). Supported values mirror direction.

weights

Optional non-negative observation weights passed to betareg().

Value

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.

Examples

set.seed(1)
X <- matrix(rnorm(200), 100, 2);
Y <- plogis(0.5 + X[,1]-X[,2]);
betareg_step_aic(X, Y)
#>     (Intercept)              X1              X2 phi|(Intercept) 
#>       0.4913849       0.9816406      -0.9826776      11.1205505 
Y <- rbeta(100, Y*20, (1-Y)*20)
betareg_step_aic(X, Y)
#>     (Intercept)              X1              X2 phi|(Intercept) 
#>       0.3941879       0.9889555      -0.8456512       3.2232473