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

This function consists of several sampling algorithms for Bayesian estimation for finite mixture of Normal distributions.

1 2 3 |

`data ` |
The vector of data with size |

`k ` |
The number of components of mixture distribution. Defult is |

`iter ` |
The number of iteration for the sampling algorithm. |

`burnin ` |
The number of burn-in iteration for the sampling algorithm. |

`lambda ` |
For the case |

`df ` |
Degrees of freedom (> 0, maybe non-integer). df = Inf is allowed. |

`k.start ` |
For the case |

`mu.start ` |
Initial value for parameter of mixture distribution. |

`sig.start` |
Initial value for parameter of mixture distribution. |

`pi.start ` |
Initial value for parameter of mixture distribution. |

`k_max ` |
For the case |

`trace ` |
Logical: if TRUE (default), tracing information is printed. |

Sampling from finite mixture of Gamma distribution, with density:

*Pr(x|k, \underline{π}, \underline{μ}, \underline{σ}) = ∑_{i=1}^{k} π_{i} N(x|μ_{i}, σ_{i}),*

where `k`

is the number of components of mixture distribution (as a defult we assume is `unknown`

).
The prior distributions are defined as below

* P(K=k) \propto \frac{λ^k}{k!}, \ \ \ k=1,...,k_{max},*

* π_{i} | k \sim Dirichlet( 1,..., 1 ),*

* α_{i} | k \sim Gamma(ν, υ),*

* β_i | k \sim G(η, τ),*

for more details see Mohammadi et al. (2013) and Mohammadi and Salehi-Rad (2012).

An object with `S3`

class `"bmixt"`

is returned:

`all_k ` |
A vector which includes the waiting times for all iterations. It is needed for monitoring the convergence of the BD-MCMC algorithm. |

`all_weights` |
A vector which includes the waiting times for all iterations. It is needed for monitoring the convergence of the BD-MCMC algorithm. |

`pi_sample ` |
A vector which includes the MCMC samples after burn-in from parameter |

`mu_sample ` |
A vector which includes the MCMC samples after burn-in from parameter |

`sig_sample ` |
A vector which includes the MCMC samples after burn-in from parameter |

`data ` |
The original data. |

Reza Mohammadi [email protected]

Stephens, M. (2000) Bayesian analysis of mixture models with an unknown number of components-an alternative to reversible jump methods. *Annals of statistics*, 28(1):40-74

Richardson, S. and Green, P. J. (1997) On Bayesian analysis of mixtures with an unknown number of components. *Journal of the Royal Statistical Society: series B*, 59(4):731-792

Green, P. J. (1995) Reversible jump Markov chain Monte Carlo computation and Bayesian model determination. *Biometrika*, 82(4):711-732

Cappe, O., Christian P. R., and Tobias, R. (2003) Reversible jump, birth and death and more general continuous time Markov chain Monte Carlo samplers. *Journal of the Royal Statistical Society: Series B*, 65(3):679-700

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

Wade, S. and Ghahramani, Z. (2018) Bayesian Cluster Analysis: Point Estimation and Credible Balls (with Discussion). *Bayesian Analysis*, 13(2):559-626

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ```
## Not run:
# simulating data from mixture of Normal with 3 components
n = 500
weight = c( 0.3, 0.5, 0.2 )
mean = c( 0 , 10 , 3 )
sd = c( 1 , 1 , 1 )
data = rmixnorm( n = n, weight = weight, mean = mean, sd = sd )
# plot for simulation data
hist( data, prob = TRUE, nclass = 30, col = "gray" )
x = seq( -20, 20, 0.05 )
densmixnorm = dmixnorm( x, weight, mean, sd )
lines( x, densmixnorm, lwd = 2 )
# Runing bdmcmc algorithm for the above simulation data set
bmixt.obj = bmixt( data, k = 3, iter = 1000 )
summary( bmixt.obj )
## End(Not run)
``` |

```
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
Iteration 100
Iteration 200
Iteration 300
Iteration 400
Iteration 500
Iteration 600
Iteration 700
Iteration 800
Iteration 900
Iteration 1000
1000 iteration done.
Number of mixture components = 3
Estimated pi = 0.08 0.35 0.58
Estimated mu = 8.3 9.05 2.23
Estimated sig = 0.49 0.39 2.74
Estimated df = 1
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.