mixgamma: Mixture of Gamma distribution

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

Random generation and density function for the finite mixture of Gamma distribution.

Usage

1
2
3
rmixgamma( n = 10, weight = 1, alpha = 1, beta = 1 )

dmixgamma( x, weight = 1, alpha = 1, beta = 1 )

Arguments

n

The number of samples required.

x

The vector of quantiles.

weight

The vector of probability weights, with length equal to number of components (k). This is assumed to sum to 1; if not, it is normalized.

alpha

The vector of non-negative parameters of the Gamma distribution.

beta

The vector of non-negative parameters of the Gamma distribution.

Details

Sampling from finite mixture of Gamma distribution, with density:

Pr(x|\underline{w}, \underline{α}, \underline{β}) = ∑_{i=1}^{k} w_{i} Gamma(x|α_{i}, β_{i}),

where

Gamma(x|α_{i}, β_{i})=\frac{(β_{i})^{α_{i}}}{Γ(α_{i})} x^{α_{i}-1} e^{-β_{i}x}.

Value

Generated data as an vector with size n.

Author(s)

Reza Mohammadi [email protected]

References

Mohammadi, A., Salehi-Rad, M. R., and Wit, E. C. (2013) Using mixture of Gamma distributions for Bayesian analysis in an M/G/1 queue with optional second service. Computational Statistics, 28(2):683-700

Mohammadi, A., and Salehi-Rad, M. R. (2012) Bayesian inference and prediction in an M/G/1 with optional second service. Communications in Statistics-Simulation and Computation, 41(3):419-435

See Also

rmixnorm, rmixt

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Not run: 
n      = 10000   
weight = c( 0.6  , 0.3  , 0.1   )
alpha  = c( 100  , 200  , 300   )
beta   = c( 100/3, 200/4, 300/5 )
    
data = rmixgamma( n = n, weight = weight, alpha = alpha, beta = beta )
  
hist( data, prob = TRUE, nclass = 30, col = "gray" )
  
x            = seq( -20, 20, 0.05 )
densmixgamma = dmixnorm( x, weight, alpha, beta )
      
lines( x, densmixgamma, lwd = 2 )

## End(Not run)

Example output

Loading required package: BDgraph
Loading required package: Matrix
Loading required package: igraph

Attaching package: 'igraph'

The following objects are masked from 'package:stats':

    decompose, spectrum

The following object is masked from 'package:base':

    union


Attaching package: 'BDgraph'

The following object is masked from 'package:igraph':

    compare

bmixture documentation built on Sept. 11, 2019, 9:07 a.m.