The gamma mixture density and auxiliary functions.
mixgamma(..., param = c("ab","ms","mn"), likelihood = c("poisson","exp"))ms2gamma(m, s, drop =TRUE)mn2gamma(m, n, likelihood = c("poisson","exp"), drop =TRUE)## S3 method for class 'gammaMix'print(x,...)## S3 method for class 'gammaPoissonMix'print(x,...)## S3 method for class 'gammaExpMix'print(x,...)## S3 method for class 'gammaMix'summary(object, probs = c(0.025,0.5,0.975),...)## S3 method for class 'gammaPoissonMix'summary(object, probs = c(0.025,0.5,0.975),...)
Arguments
...: List of mixture components.
param: Determines how the parameters in the list are interpreted. See details.
likelihood: Defines with what likelihood the Gamma density is used (Poisson or Exp). Defaults to poisson.
m: Vector of means of the Gamma mixture components
s: Vector of standard deviations of the gamma mixture components,
drop: Delete the dimensions of an array which have only one level.
n: Vector of sample sizes of the Gamma mixture components.
x: The mixture to print
object: Gamma mixture object.
probs: Quantiles reported by the summary function.
Returns
mixgamma returns a gamma mixture with the specified mixture components. ms2gamma and mn2gamma return the equivalent natural a and b parametrization given parameters m, s, or n.
Details
Each entry in the ... argument list is expected to be a triplet of numbers which defines the weight wk, first and second parameter of the mixture component k. A triplet can optionally be named which will be used appropriately.
The first and second parameter can be given in different parametrizations which is set by the param option:
ab: Natural parametrization of Gamma density (a=shape and b=rate). Default.
ms: Mean and standard deviation, m=a/b and s=a/b.
mn: Mean and number of observations. Translation to natural parameter depends on the likelihood argument. For a Poisson likelihood n=b (and a=mn), for an Exp likelihood n=a (and b=n/m).
Examples
# Gamma mixture with robust and informative componentgmix <- mixgamma(rob = c(0.3,20,4), inf = c(0.7,50,10))# objects can be printedgmix
# or explicitlyprint(gmix)# summaries are definedsummary(gmix)# sub-components may be extracted# by component numbergmix[[2]]# or component namegmix[["inf"]]# alternative mean and standard deviation parametrizationgmsMix <- mixgamma(rob = c(0.5,8,0.5), inf = c(0.5,9,2), param ="ms")# or mean and number of observations parametrizationgmnMix <- mixgamma(rob = c(0.2,2,1), inf = c(0.8,2,5), param ="mn")# and mixed parametrizations are also possiblegfmix <- mixgamma(rob1 = c(0.15, mn2gamma(2,1)), rob2 = c(0.15, ms2gamma(2,5)), inf = c(0.7,50,10))
See Also
Other mixdist: mix, mixbeta(), mixcombine(), mixmvnorm(), mixnorm(), mixplot