Stepwise Beta regression by AICc (finite-sample corrected AIC)
Source:R/var_select_beta.R
betareg_step_aicc.RdGreedy forward/backward search minimizing AICc computed on betareg fits with
optional precision-submodel selection and observation weights.
Usage
betareg_step_aicc(
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
Link for the mean submodel (passed to
betareg). Default"logit".- link.phi
Link for precision parameter. Default
"log".- type
Likelihood type for
betareg, e.g."ML".- trace
Logical; print stepwise trace.
- max_steps
Maximum number of greedy steps (default
p).- epsilon
Minimal AICc improvement to accept a move.
- X_phi
Optional matrix of candidate predictors for the precision (phi) submodel. When
direction_phienables precision updates andX_phiisNULL, the function reusesX.- direction_phi
Stepwise direction for the precision submodel. Defaults to
"none"(no phi selection). Supported values mirrordirection.- weights
Optional non-negative observation weights passed to
betareg().
Value
See betareg_step_aic().
Examples
set.seed(1);
X <- matrix(rnorm(400), 100, 4);
Y <- plogis(X[,1]+0.5*X[,2])
betareg_step_aicc(X, Y)
#> (Intercept) X1 X2 X3 X4
#> 3.248654e-04 9.858079e-01 4.932358e-01 0.000000e+00 0.000000e+00
#> phi|(Intercept)
#> 1.307252e+01
Y <- rbeta(100, Y*25, (1-Y)*25);
betareg_step_aicc(X, Y)
#> (Intercept) X1 X2 X3 X4
#> -0.009987406 1.044515121 0.532545592 0.000000000 0.000000000
#> phi|(Intercept)
#> 3.135373326