cnorm.betabinomial1 {cNORM} | R Documentation |
Fit a beta binomial regression model
Description
This function fits a beta binomial regression model where both the mean and standard deviation of the response variable are modeled as polynomial functions of the predictor variable. While 'cnorm-betabinomial2' fits a beta-binomial model on the basis of /$alpha$ and /$beta$ of a beta binomial function, this function fits /$mu$ and /$sigma$, which are then used to estimate the beta binomial distribution parameters.
Usage
cnorm.betabinomial1(
age,
score,
n = NULL,
weights = NULL,
mu = 3,
sigma = 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 |
Number of items in the test, resp. maximum score to be achieved |
weights |
A numeric vector of weights for each observation. Default is NULL (equal weights). |
mu |
Integer specifying the degree of the polynomial for the mean model. Default is 2. |
sigma |
Integer specifying the degree of the polynomial for the standard deviation model. Default is 1. |
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 percentile (= no transformation); a double vector with the mean and standard deviation can as well, be provided f. e. c(10, 3) for Wechsler scale index points |
plot |
Logical indicating whether to plot the model. Default is TRUE. |
Details
The function standardizes the input variables, fits polynomial models for both the mean and standard deviation, and uses maximum likelihood estimation to find the optimal parameters. The optimization is performed using the BFGS method.
Value
A list of class "cnormBetaBinomial" containing:
beta_est |
Estimated coefficients for the mean model |
gamma_est |
Estimated coefficients for the log-standard deviation model |
se |
Standard errors of the estimated coefficients |
mu |
Degree of the polynomial for the mean model |
sigma |
Degree of the polynomial for the standard deviation model |
result |
Full result from the optimization procedure |