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. > 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 3.172116 iter 2 value 2.336088 iter 3 value 0.428722 iter 4 value -0.432135 iter 5 value -0.915556 iter 6 value -1.031657 iter 7 value -1.049364 iter 8 value -1.055356 iter 9 value -1.055953 iter 10 value -1.056808 iter 11 value -1.056810 iter 11 value -1.056810 final value -1.056810 converged $shape [1] 9.496487 $scale [1] 13.65474 > prefit(x, "gamma", "mle", list(shape=1, scale=1), lower=-Inf, upper=Inf, silent=TRUE) $shape [1] 9.49567 $scale [1] 13.65337 > > prefit(x, "gamma", "mle", list(shape=3), fix.arg=list(scale=7/2), lower=-Inf, upper=Inf, silent=TRUE) $shape [1] 0.5662104 > > prefit(x, "gamma", "qme", list(shape=1, scale=1), probs=1:2/3, lower=-Inf, upper=Inf, silent=TRUE) $shape [1] 5.593927 $scale [1] 8.148365 > > prefit(x, "gamma", "mge", list(shape=1, scale=1), gof="CvM", lower=-Inf, upper=Inf, silent=TRUE) $shape [1] 6.761779 $scale [1] 9.586205 > prefit(x, "gamma", "mge", list(shape=1, scale=1), gof="AD", lower=-Inf, upper=Inf, silent=TRUE) $shape [1] 7.329232 $scale [1] 10.41638 > > # (2) geometric > x <- rgeom(nsample, 1/7) > prefit(x, "geom", "mle", list(prob=1/2), lower=-Inf, upper=Inf, silent=TRUE) $prob [1] 0.1694915 > 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.1694915 > prefit(x, "geom", "qme", list(prob=1/2), probs=1/2, lower=-Inf, upper=Inf) $prob [1] 0.3100255 > > > # (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] 19.35008 $scale [1] 6.04737 > > > proc.time() user system elapsed 1.73 0.25 1.96