gammamixEM | R Documentation |
Return EM algorithm output for mixtures of gamma distributions.
gammamixEM(x, lambda = NULL, alpha = NULL, beta = NULL, k = 2, mom.start = TRUE, fix.alpha = FALSE, epsilon = 1e-08, maxit = 1000, maxrestarts = 20, verb = FALSE)
x |
A vector of length n consisting of the data. |
lambda |
Initial value of mixing proportions. If |
alpha |
Starting value of vector of component shape parameters. If non-NULL, |
beta |
Starting value of vector of component scale parameters. If non-NULL and a vector,
|
k |
Number of components. Initial value ignored unless |
mom.start |
Logical to indicate if a method of moments starting value strategy should be implemented. If |
epsilon |
The convergence criterion. Convergence is declared when the change in the observed data log-likelihood increases by less than epsilon. |
fix.alpha |
Logical to indicate if the components should have a common shape parameter |
maxit |
The maximum number of iterations. |
maxrestarts |
The maximum number of restarts allowed in case of a problem with the particular starting values chosen (each restart uses randomly chosen starting values). |
verb |
If TRUE, then various updates are printed during each iteration of the algorithm. |
gammamixEM
returns a list of class mixEM
with items:
x |
The raw data. |
lambda |
The final mixing proportions. |
gamma.pars |
A 2xk matrix where each column provides the component estimates of |
loglik |
The final log-likelihood. |
posterior |
An nxk matrix of posterior probabilities for observations. |
all.loglik |
A vector of each iteration's log-likelihood. This vector includes both the initial and the final values; thus, the number of iterations is one less than its length. |
ft |
A character vector giving the name of the function. |
Dempster, A. P., Laird, N. M., and Rubin, D. B. (1977) Maximum Likelihood From Incomplete Data Via the EM Algorithm, Journal of the Royal Statistical Society, Series B, 39(1), 1–38.
Young, D. S., Chen, X., Hewage, D., and Nilo-Poyanco, R. (2019) Finite Mixture-of-Gamma Distributions: Estimation, Inference, and Model-Based Clustering, Advances in Data Analysis and Classification, 13(4), 1053–1082.
##Analyzing a 3-component mixture of gammas. set.seed(100) x <- c(rgamma(200, shape = 0.2, scale = 14), rgamma(200, shape = 32, scale = 10), rgamma(200, shape = 5, scale = 6)) out <- gammamixEM(x, lambda = c(1, 1, 1)/3, verb = TRUE) out[2:4]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.