Description Arguments Details Value See Also Examples
Calling extract()
on an mcmcoutput
object with a multivariate Normal
mixture model extracts single samples.
object |
An |
index |
An |
This function simplifies the analysis of multivariate Normal mixtures that
come along with matrices instead of vectors for component parameters as it
extracts the mean matrix, the variance matrices and in addition the inverted
variance matrices with a single call. In additon, it enriches the output
object with metadata like the dimension of the data r
, the number of
components K
, and the distribution (in this case "normult
).
An mcmcextract
object containing the parameters, weights, and
metadata of the extracted dimension.
mcmcoutput for the definition of the mcmcoutput
class
mcmcoutputperm for the definition of the mcmcoutputperm
class
mcmcextract for the output class
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # Generate a multivariate Normal mixture model.
means <- matrix(c(1, 2, 2, 4), nrow = 2)
var1 <- matrix(c(1, 0.3, 0.3, 2), nrow=2)
var2 <- matrix(c(3, 0.3, 0.3, 6), nrow=2)
vars <- array(c(var1,var2), dim = c(2,2,2))
f_model <- model(dist='normult', K = 2, r = 2, par = list(mu=means, sigma=vars))
f_data <- simulate(f_model)
# Define the hyper-parameters for MCMC sampling.
f_mcmc <- mcmc(storepost = FALSE)
# Define the prior distribution by relying on the data.
f_prior <- priordefine(f_data, f_model)
# Start MCMC sampling.
f_output <- mixturemcmc(f_data, f_model, f_prior, f_mcmc)
# Extract a single MCMC sample.
f_output1 <- extract(f_output, index = 1000)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.