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 5.000763 iter 2 value 3.804723 iter 3 value 3.204614 iter 4 value 3.113290 iter 5 value 3.013228 iter 6 value 3.009428 iter 7 value 3.009375 iter 8 value 3.009359 iter 9 value 3.009349 iter 10 value 3.009349 iter 10 value 3.009349 iter 10 value 3.009349 final value 3.009349 converged $shape [1] 3.592964 $scale [1] 5.249211 > prefit(x, "gamma", "mle", list(shape=1, scale=1), lower=-Inf, upper=Inf, silent=TRUE) $shape [1] 3.592966 $scale [1] 5.249214 > > prefit(x, "gamma", "mle", list(shape=3), fix.arg=list(scale=7/2), lower=-Inf, upper=Inf, silent=TRUE) $shape [1] 0.5402733 > > prefit(x, "gamma", "qme", list(shape=1, scale=1), probs=1:2/3, lower=-Inf, upper=Inf, silent=TRUE) $shape [1] 12.2358 $scale [1] 23.64006 > > prefit(x, "gamma", "mge", list(shape=1, scale=1), gof="CvM", lower=-Inf, upper=Inf, silent=TRUE) $shape [1] 4.164329 $scale [1] 7.090305 > prefit(x, "gamma", "mge", list(shape=1, scale=1), gof="AD", lower=-Inf, upper=Inf, silent=TRUE) $shape [1] 2.536479 $scale [1] 3.713163 > > # (2) geometric > x <- rgeom(nsample, 1/7) > prefit(x, "geom", "mle", list(prob=1/2), lower=-Inf, upper=Inf, silent=TRUE) $prob [1] 0.1587296 > 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.1587296 > prefit(x, "geom", "qme", list(prob=1/2), probs=1/2, lower=-Inf, upper=Inf) $prob [1] 0.3452465 > > > # (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] 21.1905 $scale [1] 6.395207 > > > proc.time() user system elapsed 1.82 0.34 2.17