# how to check Goodness of fit for Gamma Distribution, Weibull Distribution, Exponential Distribution with Anderson Darling Test

how to check Goodness of fit for Gamma Distribution, Weibull Distribution, Exponential Distribution with Anderson Darling Test?

# Anderson-Darling Test is a goodness-of-fit test that determines how well your data fits a given distribution.

df <- data.frame(body_fat=
c(25.3, 29.3, 37.7, 32.8, 24.6, 26.5, 21.2, 28.4, 24.0, 28.7, 37.4, 30.7, 36.7, 28.2, 26.4,
37.1, 31.1, 43.1, 34.1, 26.7, 30.9, 30.0, 22.1, 24.4, 22.5, 24.9, 18.2, 25.9, 28.3, 18.7,
22.4, 23.6, 26.8, 17.8, 27.4, 16.8, 26.1, 20.8, 22.7, 20.2, 20.3, 31.9, 22.9, 25.3, 17.3,
41.0, 25.8, 36.6, 27.8, 39.4, 36.4, 46.8, 40.5, 43.0, 39.5, 39.4, 24.8, 35.0, 25.3, 42.5,
27.8, 35.8, 39.2, 38.3, 34.1, 39.9, 32.5, 29.9, 32.0, 23.0, 28.5, 26.4, 33.9, 29.4, 29.4,
21.0, 22.4, 25.3, 20.2, 22.5, 23.4, 29.5, 21.9, 19.2, 28.6, 23.4, 23.2, 18.1, 31.4, 22.9, 25.6))
hist(df\$body_fat,
breaks=12,
xlim=c(10,50),
col="blue",
border="black",
ylim=c(0,16),
xlab="% Fat",
ylab="Counts",
main="Histogram of % Body Fat")
library(cmstatr)
library(gofgamma)
anderson_darling_normal(x=df\$body_fat, alpha = 0.05)
anderson_darling_lognormal(x=df\$body_fat, alpha = 0.05)
anderson_darling_weibull(x=df\$body_fat, alpha = 0.05)
gofgamma::test.AD(data=df\$body_fat, boot = 500, alpha = 0.05) # Gamma

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.