This function fits a beta-binomial regression model where both the alpha
and beta parameters of the beta-binomial distribution are modeled as
polynomial functions of the predictor variable (typically age). While
'cnorm.betabinomial1' fits a beta-binomial model on the basis of \(\mu\)
and \(\sigma\), this function fits the model directly on the basis of
\(\alpha\) and \(\beta\). This is the recommended default approach
(see cnorm.betabinomial).
cnorm.betabinomial2(
age,
score,
n = NULL,
weights = NULL,
alpha_degree = 3,
beta_degree = 3,
control = NULL,
scale = "T",
plot = TRUE
)A list of class "cnormBetaBinomial2" containing:
Estimated coefficients for the alpha model
Estimated coefficients for the beta model
Standard errors of the estimated coefficients
Degree of the polynomial for the alpha model
Degree of the polynomial for the beta model
Full result from the optimization procedure
A numeric vector of predictor values (e.g., age).
A numeric vector of response values.
The maximum score (number of trials in the beta-binomial distribution). If NULL, max(score) is used.
A numeric vector of weights for each observation. Default is NULL (equal weights).
Integer specifying the degree of the polynomial for the alpha model. Default is 3.
Integer specifying the degree of the polynomial for the beta model. Default is 3.
A list of control parameters to be passed to the
optim function (method "L-BFGS-B"). Any parameters not specified
are filled with adaptive defaults based on problem size.
Type of norm scale, either "T" (default), "IQ", "z" or a double vector with the mean and standard deviation.
Logical indicating whether to plot the model. Default is TRUE.
The function standardizes the input variables, fits polynomial models for both the alpha and beta parameters, and uses maximum likelihood estimation with analytic (digamma-based) gradients to find the optimal parameters. The optimization is performed using the L-BFGS-B method with parameter bounds to prevent numerical issues.