diagnostics.betabinomial function

Diagnostic Information for Beta-Binomial Model

Diagnostic Information for Beta-Binomial Model

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)

Arguments

  • model: An object of class "cnormBetaBinomial", 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

Returns

A list containing the following diagnostic information:

  • converged: Logical indicating whether the optimization algorithm converged.
  • n_evaluations: Number of function evaluations performed during optimization.
  • n_gradient: Number of gradient evaluations performed during optimization.
  • final_value: Final value of the objective function (negative log-likelihood).
  • message: Any message returned by the optimization algorithm.
  • AIC: Akaike Information Criterion.
  • BIC: Bayesian Information Criterion.
  • max_gradient: Maximum absolute gradient at the solution (if available).

Details

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.

Examples

## Not run: # Fit a beta-binomial model model <- cnorm.betabinomial(ppvt$age, ppvt$raw) # Get diagnostic information diag_info <- diagnostics.betabinomial(model) # Print the diagnostic information print(diag_info) # Summary the diagnostic information summary(diag_info) # Check if the model converged if(diag_info$converged) { cat("Model converged successfully.\n") } else { cat("Warning: Model did not converge.\n") } # Compare AIC and BIC cat("AIC:", diag_info$AIC, "\n") cat("BIC:", diag_info$BIC, "\n") ## End(Not run)