rriskMMEdist {rriskDistributions} | R Documentation |
Fitting univariate distributions by matching moments
Description
Fits a univariate distribution by matching moments.
Usage
rriskMMEdist(data, distr)
Arguments
data |
a numerical vector. |
distr |
A character string "name" naming a distribution or directly the
density function |
Details
This function is an alias of the function mmedist
from the package
fitdistrplus (Version 0.1-2). The original function was extended to
fitting additional distributions. Parameter of the following distribution
families can be estimated in this function: normal, lognormal, exponential,
Poisson, gamma, logistic, negative binomial, geometric, Beta and continuous
univariate.
For more details see the assistance page of the function
mmedist
from the package fitdistrplus.
This function is not intended to be called directly but is internally
called in rriskFitdist.cont
.
Value
rriskMMEdist
returns the named parameter or a named vector of parameters.
Author(s)
Matthias Greiner matthias.greiner@bfr.bund.de (BfR),
Kristin Tolksdorf kristin.tolksdorf@bfr.bund.de (BfR),
Katharina Schueller schueller@stat-up.de (STAT-UP Statistical Consulting),
Natalia Belgorodski belgorodski@stat-up.de (STAT-UP Statistical Consulting),
Marie-Laure Delignette-Muller (coauthor of the package fitdistrplus),
Christophe Dutang (coauthor of the package fitdistrplus)
Examples
## Continuous distributions
set.seed(1)
x1 <- stats::rnorm(500, mean = 2, sd = 0.7)
rriskMMEdist(x1, "norm")
rriskMMEdist(x1, "exp")
rriskMMEdist(x1, "gamma")
rriskMMEdist(x1, "logis")
rriskMMEdist(x1, "unif")
## produces an error:
# rriskMMEdist(x1, "lnorm")
# rriskMMEdist(x1, "beta")
## Discrete distributions
set.seed(2)
x2 <- rpois(500, lambda = 3)
rriskMMEdist(x2, "pois")
rriskMMEdist(x2, "nbinom")
rriskMMEdist(x2, "geom")