R Under development (unstable) (2025-01-06 r87534 ucrt) -- "Unsuffered Consequences" Copyright (C) 2025 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > require("fitdistrplus") Loading required package: fitdistrplus Loading required package: MASS Loading required package: survival > > # (1) basic fit of a gamma distribution by maximum likelihood estimation > # > data(groundbeef) > serving <- groundbeef$serving > fitg <- fitdist(serving, "gamma") > > logLik(fitg) [1] -1253.625 > vcov(fitg) shape rate shape 0.116589223 1.582079e-03 rate 0.001582079 2.437633e-05 > coef(fitg) shape rate 4.00955898 0.05443907 > AIC(fitg) [1] 2511.25 > AIC(fitg, k = log(fitg$n)) # should give BIC [1] 2518.325 > BIC(fitg) [1] 2518.325 > > fitg <- fitdist(serving, "gamma", method="mme") > > logLik(fitg) [1] -1253.825 > vcov(fitg) shape rate shape 0.174083304 2.363796e-03 rate 0.002363796 3.516629e-05 > coef(fitg) shape rate 4.22848617 0.05741663 > AIC(fitg) [1] 2511.65 > AIC(fitg, k = log(fitg$n)) # should give BIC [1] 2518.724 > BIC(fitg) [1] 2518.724 > > # (2) Fit of a lognormal distribution to bacterial contamination data > # > data(smokedfish) > fitsf <- fitdistcens(smokedfish,"lnorm") > logLik(fitsf) [1] -90.65154 > vcov(fitsf) meanlog sdlog meanlog 0.21502901 -0.09782285 sdlog -0.09782285 0.23781325 > coef(fitsf) meanlog sdlog -3.627606 3.544570 > AIC(fitsf) [1] 185.3031 > AIC(fitsf, k = log(fitsf$n)) # should give BIC [1] 190.5725 > BIC(fitsf) [1] 190.5725 > > > proc.time() user system elapsed 0.93 0.17 1.09