Learn R Programming

Renext (version 2.0-0)

mom2par: Parameters from moments

Description

Compute parameters from (theoretical) moments

Usage

mom2par(densfun = "exponential",
           mean,
           sd = NA)

Arguments

densfun
Name of the distribution. This can be at present time: "exponential", "weibull", "gpd", "gamma", "negative binomial".
mean
Theoretical mean (expectation) of the distribution. Can be a vector, in which case the parameters will be vectors.
sd
Standard deviation.

Value

  • A named list containing the parameters values e.g. with names shape and scale. When mean or sd is vector the list contains vectors.

Details

For some distributions like Weibull, it is necessary to find a numerical solution since the parameters have no closed form expression involving the moments.

Examples

Run this code
## Weibull
mom2par(densfun = "weibull", mean = 1, sd = 2) 
## Genrealised Pareto
mom2par(densfun = "gpd", mean = 1, sd = 2)
## Gamma
mom2par(densfun = "gamma", mean = 1:10, sd = 1)

Run the code above in your browser using DataLab