R Under development (unstable) (2025-06-30 r88369 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 5.935969 iter 2 value 3.677720 iter 3 value 3.013285 iter 4 value 2.775636 iter 5 value 2.690607 iter 6 value 2.688674 iter 7 value 2.688628 iter 8 value 2.688612 iter 9 value 2.688611 iter 10 value 2.688610 iter 10 value 2.688610 iter 10 value 2.688610 final value 2.688610 converged $shape [1] 2.814599 $scale [1] 4.656148 > prefit(x, "gamma", "mle", list(shape=1, scale=1), lower=-Inf, upper=Inf, silent=TRUE) $shape [1] 2.814574 $scale [1] 4.656088 > > prefit(x, "gamma", "mle", list(shape=3), fix.arg=list(scale=7/2), lower=-Inf, upper=Inf, silent=TRUE) $shape [1] 0.5039441 > > prefit(x, "gamma", "qme", list(shape=1, scale=1), probs=1:2/3, lower=-Inf, upper=Inf, silent=TRUE) $shape [1] 10.7335 $scale [1] 18.89425 > > prefit(x, "gamma", "mge", list(shape=1, scale=1), gof="CvM", lower=-Inf, upper=Inf, silent=TRUE) $shape [1] 5.183955 $scale [1] 8.779391 > prefit(x, "gamma", "mge", list(shape=1, scale=1), gof="AD", lower=-Inf, upper=Inf, silent=TRUE) $shape [1] 2.879109 $scale [1] 4.634191 > > # (2) geometric > x <- rgeom(nsample, 1/7) > prefit(x, "geom", "mle", list(prob=1/2), lower=-Inf, upper=Inf, silent=TRUE) $prob [1] 0.1315776 > 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.1315776 > prefit(x, "geom", "qme", list(prob=1/2), probs=1/2, lower=-Inf, upper=Inf) $prob [1] 0.1679816 > > > # (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] 52.7725 $scale [1] 15.6538 > > > proc.time() user system elapsed 1.79 0.34 2.11