R Under development (unstable) (2025-07-02 r88374 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 10.900085 iter 2 value 7.602870 iter 3 value 4.709671 iter 4 value 1.215515 iter 5 value -0.898234 iter 6 value -0.903964 iter 7 value -0.997827 iter 8 value -1.077601 iter 9 value -1.322815 iter 10 value -1.351482 iter 11 value -1.352007 iter 12 value -1.352010 iter 13 value -1.352012 iter 14 value -1.352012 iter 14 value -1.352012 iter 14 value -1.352012 final value -1.352012 converged $shape [1] 1.929098 $scale [1] 5.401177 > prefit(x, "gamma", "mle", list(shape=1, scale=1), lower=-Inf, upper=Inf, silent=TRUE) $shape [1] 1.929029 $scale [1] 5.400921 > > prefit(x, "gamma", "mle", list(shape=3), fix.arg=list(scale=7/2), lower=-Inf, upper=Inf, silent=TRUE) $shape [1] 0.3997274 > > prefit(x, "gamma", "qme", list(shape=1, scale=1), probs=1:2/3, lower=-Inf, upper=Inf, silent=TRUE) $shape [1] 0.2370068 $scale [1] 5.274836 > > prefit(x, "gamma", "mge", list(shape=1, scale=1), gof="CvM", lower=-Inf, upper=Inf, silent=TRUE) $shape [1] 1.473108 $scale [1] 4.221697 > prefit(x, "gamma", "mge", list(shape=1, scale=1), gof="AD", lower=-Inf, upper=Inf, silent=TRUE) $shape [1] 1.45813 $scale [1] 3.974695 > > # (2) geometric > x <- rgeom(nsample, 1/7) > prefit(x, "geom", "mle", list(prob=1/2), lower=-Inf, upper=Inf, silent=TRUE) $prob [1] 0.1162774 > 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.1162774 > prefit(x, "geom", "qme", list(prob=1/2), probs=1/2, lower=-Inf, upper=Inf) $prob [1] 0.1278616 > > > # (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] 11.07944 $scale [1] 2.172262 > > > proc.time() user system elapsed 1.79 0.28 2.06