Learn R Programming

cylcop (version 0.2.0)

gammamix: Density, Distribution, Quantiles and Random Number Generation for the mixed gamma distribution

Description

The number of components in the mixed gamma distribution is specified by the length of the parameter vectors. The quantiles are numerically obtained from the distribution function using monotone cubic splines.

Usage

rgammamix(n, shape, rate = 1, scale = 1/rate, prop)

dgammamix(x, shape, rate = 1, scale = 1/rate, prop)

pgammamix(q, shape, rate = 1, scale = 1/rate, prop)

qgammamix(p, shape, rate = 1, scale = 1/rate, prop)

Value

  • dgammamix() gives a vector of length length(x) containing the density at x.

  • pgammamix() gives a vector of length length(q) containing the distribution function at the corresponding values of q.

  • qgammamix() gives a vector of length length(p) containing the quantiles at the corresponding values of p.

  • rgammamix() generates a vector of length n containing the random samples.

Arguments

n

integer value, the number of random samples to be generated with rgammamix().

shape

numeric vector holding the shape parameter of the components.

rate

numeric vector an alternative way to specify the scale (scale = 1 / rate).

scale

numeric vector holding the scale parameter of the components.

prop

numeric vector, holding the mixing proportions of the components.

x

numeric vector giving the points where the density function is evaluated.

q

numeric vector giving the quantiles where the distribution function is evaluated.

p

numeric vector giving the probabilities where the quantile function is evaluated.

Examples

Run this code

rgammamix(10, shape = c(1, 3, 7), scale = c(2, 2, 4), prop = c(0.6, 0.3, 0.1))

dgammamix(c(0, 2, 1), shape = c(1, 3), rate = c(2, 2), prop = c(0.6, 0.4))

prob <- pgammamix(c(0.1, 7), shape = c(1, 3, 7), scale = c(2, 2, 4), prop = c(0.6, 0.3, 0.1))
prob
qgammamix(prob, shape = c(1, 3, 7), scale = c(2, 2, 4), prop = c(0.6, 0.3, 0.1))

Run the code above in your browser using DataLab