Displaying 1 result from an estimated 1 matches for "plotgammamixtur".
Did you mean:
plotgammamixture
2011 Feb 28
0
Gamma mixture models with flexmix
...lp me get flexmix to correctly model mixtures of
## Gamma distributions. See examples below.
##
library('flexmix')
##
## Plot a histogram of dat and the Gamma mixture model given by
## shapes, rates and pis that is intended as a model of the
## distribution from which dat was drawn.
##
plotGammaMixture <- function(dat, shapes, rates, pis) {
KK <- length(pis)
stopifnot(KK == length(shapes))
stopifnot(KK == length(rates))
ho <- hist(dat, plot=FALSE)
x <- seq(ho$breaks[1], ho$breaks[length(ho$breaks)],
length.out=1000)
y <- list()
for (ii in 1:KK) {
y[[...