Skip to contents

This function estimates the parameters of a chi-square distribution from the provided data using maximum likelihood estimation, and then calculates the AIC value based on the fitted distribution.

Usage

util_chisq_aic(.x)

Arguments

.x

A numeric vector containing the data to be fitted to a chi-square distribution.

Value

The AIC value calculated based on the fitted chi-square distribution to the provided data.

Details

This function calculates the Akaike Information Criterion (AIC) for a chi-square distribution fitted to the provided data.

Author

Steven P. Sanderson II, MPH

Examples

# Example 1: Calculate AIC for a sample dataset
set.seed(123)
x <- rchisq(30, df = 3)
util_chisq_aic(x)
#> Warning: NaNs produced
#> Warning: NaNs produced
#> Warning: NaNs produced
#> Warning: NaNs produced
#> Warning: NaNs produced
#> Warning: NaNs produced
#> Warning: NaNs produced
#> Warning: NaNs produced
#> Warning: NaNs produced
#> Warning: NaNs produced
#> Warning: NaNs produced
#> Warning: NaNs produced
#> [1] 123.8218