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 > nsample <- 10 > > # (1) gamma > x <- rgamma(nsample, 5/2, 7/2) > > prefit(x, "gamma", "mle", list(shape=3, scale=3), lower=-Inf, upper=Inf, silent=TRUE, control=list(trace=1, REPORT=1)) initial value 13.106992 iter 2 value 10.104898 iter 3 value 8.147437 iter 4 value 6.974863 iter 5 value 6.729522 iter 6 value 6.709932 iter 7 value 6.709660 iter 8 value 6.709605 iter 9 value 6.709592 iter 9 value 6.709592 iter 9 value 6.709592 final value 6.709592 converged $shape [1] 1.047344 $scale [1] 1.454442 > prefit(x, "gamma", "mle", list(shape=1, scale=1), lower=-Inf, upper=Inf, silent=TRUE) $shape [1] 1.04733 $scale [1] 1.454416 > > prefit(x, "gamma", "mle", list(shape=3), fix.arg=list(scale=7/2), lower=-Inf, upper=Inf, silent=TRUE) $shape [1] 0.4682346 > > prefit(x, "gamma", "qme", list(shape=1, scale=1), probs=1:2/3, lower=-Inf, upper=Inf, silent=TRUE) $shape [1] 1.9974 $scale [1] 2.976664 > > prefit(x, "gamma", "mge", list(shape=1, scale=1), gof="CvM", lower=-Inf, upper=Inf, silent=TRUE) $shape [1] 0.9200302 $scale [1] 1.15838 > prefit(x, "gamma", "mge", list(shape=1, scale=1), gof="AD", lower=-Inf, upper=Inf, silent=TRUE) $shape [1] 0.8905163 $scale [1] 1.13324 > > # (2) geometric > x <- rgeom(nsample, 1/7) > prefit(x, "geom", "mle", list(prob=1/2), lower=-Inf, upper=Inf, silent=TRUE) $prob [1] 0.1492529 > tbx <- table(x) > prefit(as.numeric(names(tbx)), "geom", "mle", list(prob=1/2), lower=-Inf, upper=Inf, silent=TRUE, weights=tbx) $prob [1] 0.1492529 > prefit(x, "geom", "qme", list(prob=1/2), probs=1/2, lower=-Inf, upper=Inf) $prob [1] 0.2460113 > > > # (3) Pareto > require("actuar") Loading required package: actuar Attaching package: 'actuar' The following objects are masked from 'package:stats': sd, var The following object is masked from 'package:grDevices': cm > x <- rpareto(nsample, 6, 2) > > prefit(x, "pareto", "mme", list(shape=10, scale=10), order=1:2, memp=function(x, order) mean(x^order), lower=-Inf, upper=Inf) $shape [1] 124.0936 $scale [1] 24.65306 > > > proc.time() user system elapsed 1.15 0.12 1.28