R Under development (unstable) (2024-07-10 r86888 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 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. > library(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.626 > vcov(fitg) shape rate shape 0.115727238 1.570141e-03 rate 0.001570141 2.419982e-05 > coef(fitg) shape rate 3.99526328 0.05423688 > AIC(fitg) [1] 2511.252 > AIC(fitg, k = log(fitg$n)) # should give BIC [1] 2518.326 > BIC(fitg) [1] 2518.326 > > fitg <- fitdist(serving, "gamma", method="mme") > > logLik(fitg) [1] -1253.825 > vcov(fitg) shape rate shape 44.2171593 0.600404069 rate 0.6004041 0.008932239 > 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 1.57 0.17 1.73