| diagnostics.betabinomial | R Documentation |
This function provides diagnostic information for a fitted beta-binomial model from the cnorm.betabinomial function. It returns various metrics related to model convergence, fit, and complexity. In case age and raw scores are provided, the function as well computes R2, RMSE and bias for the norm scores based on the manifest and predicted norm scores.
diagnostics.betabinomial(model, age = NULL, score = NULL, weights = NULL)
model |
An object of class "cnormBetaBinomial" or "cnormBetaBinomial2", typically the result of a call to cnorm.betabinomial(). |
age |
An optional vector with age values. |
score |
An optional vector with raw values. |
weights |
An optional vector with weights. |
The AIC and BIC are calculated as: AIC = 2k - 2ln(L) BIC = ln(n)k - 2ln(L) where k is the number of parameters, L is the maximum likelihood, and n is the number of observations.
Please note that fit indices of mode 1 and mode 2 models are not directly comparable, since the two modes maximize different likelihoods (normal on standardized scores vs. discrete beta-binomial).
A list containing diagnostic information, including convergence, number of evaluations, log-likelihood, AIC, BIC, the maximum absolute analytic gradient at the solution (first-order optimality), parameter estimates with standard errors, z and p values, and - if age and score are provided - R2, RMSE and bias of the norm scores.
## Not run:
model <- cnorm.betabinomial(ppvt$age, ppvt$raw)
diag_info <- diagnostics.betabinomial(model)
print(diag_info)
summary(diag_info)
if(diag_info$converged) {
cat("Model converged successfully.\n")
} else {
cat("Warning: Model did not converge.\n")
}
cat("AIC:", diag_info$AIC, "\n")
cat("BIC:", diag_info$BIC, "\n")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.