R/MGFmixedgamma.R
MGFmixedgamma.Rd
Evaluate the moment generating function (MGF) of the mixed gamma distribution or a derivative of the MGF
MGFmixedgamma(x, prob, rate, shape, deriv = 0)
The value at which to evaluate the MGF
A vector of probabilities of following each gamma distribution in the mixture
A vector of rate parameter values for each gamma distribution in the mixture
A vector of shape parameter values for each gamma distribution in the mixture
An integer, the number of derivatives of the MGF to apply
The number resulting from the function evaluation
# MGF of a 40/60 mixture of two gamma distributions, evaluated at -0.1:
MGFmixedgamma(-0.1, prob = c(0.4,0.6), rate = c(0.4,0.7), shape = c(0.5,3))
#> [1] 0.759724
# Second moment of the distribution (second derivative evaluated at zero):
MGFmixedgamma(0, prob = c(0.4,0.6), rate = c(0.4,0.7), shape = c(0.5,3), deriv = 2)
#> [1] 16.56888