cnorm.betabinomial2 {cNORM} | R Documentation |
Fit a beta-binomial regression model for continuous norming
Description
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-betabinomial' fits a beta-binomial model on the basis of /$mu$ and /$sigma$, this function fits a beta-binomial model directly on the basis of /$alpha$ and /$beta$.
Usage
cnorm.betabinomial2(
age,
score,
n = NULL,
weights = NULL,
alpha_degree = 3,
beta_degree = 3,
control = NULL,
scale = "T",
plot = T
)
Arguments
age |
A numeric vector of predictor values (e.g., age). |
score |
A numeric vector of response values. |
n |
The maximum score (number of trials in the beta-binomial distribution). If NULL, max(score) is used. |
weights |
A numeric vector of weights for each observation. Default is NULL (equal weights). |
alpha_degree |
Integer specifying the degree of the polynomial for the alpha model. Default is 3. |
beta_degree |
Integer specifying the degree of the polynomial for the beta model. Default is 3. |
control |
A list of control parameters to be passed to the 'optim' function. If NULL, default values are used. |
scale |
Type of norm scale, either "T" (default), "IQ", "z" or a double vector with the mean and standard deviation. |
plot |
Logical indicating whether to plot the model. Default is TRUE. |
Details
The function standardizes the input variables, fits polynomial models for both the alpha and beta parameters, and uses maximum likelihood estimation to find the optimal parameters. The optimization is performed using the L-BFGS-B method.
Value
A list of class "cnormBetaBinomial2" containing:
alpha_est |
Estimated coefficients for the alpha model |
beta_est |
Estimated coefficients for the beta model |
se |
Standard errors of the estimated coefficients |
alpha_degree |
Degree of the polynomial for the alpha model |
beta_degree |
Degree of the polynomial for the beta model |
result |
Full result from the optimization procedure |