Displaying 1 result from an estimated 1 matches for "gmm_data".
Did you mean:
hmm_data
2008 Dec 19
2
How do I generate one vector for every row of a data frame?
...a set of data points from a Gaussian mixture
model. My mixture model is represented by a data frame that looks
like this:
> gmm
weight mean sd
1 0.3 0 1.0
2 0.2 -2 0.5
3 0.4 4 0.7
4 0.1 5 0.3
I have written the following function that generates the appropriate data:
gmm_data <- function(n, gmm) {
c(rnorm(n*gmm[1,]$weight, gmm[1,]$mean, gmm[1,]$sd),
rnorm(n*gmm[2,]$weight, gmm[2,]$mean, gmm[2,]$sd),
rnorm(n*gmm[3,]$weight, gmm[3,]$mean, gmm[3,]$sd),
rnorm(n*gmm[4,]$weight, gmm[4,]$mean, gmm[4,]$sd))
}
However, the fact that my mixture has four components is h...