Description Arguments Details Value See Also Examples
Calling swapElements()
on an mcmcoutput
object
swaps all labels by the schema given in the index
argument.
object |
An |
index |
An array specifying the extraction of the values. |
This function is merely a utility function that simplifies relabeling for
users and developers. For relabeling the labels have to be permuted and
depending on the MCMC sampling chosen there could be a lot of different
slots that need to be permuted. swapElements()
swaps the elements in any
slot that needs to be relabeled.
An mcmcoutput
object with swapped elements.
mcmcoutput for the class definition
subseq()
for generating sub-chains from MCMC samples
mcmcpermute()
for a calling function
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ## Not run:
# Generate a model of Poisson distributions.
f_model <- model("poisson", par = list(lambda = c(0.3, 1.2)), K = 2)
# Simulate data from the model.
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)
index <- matrix(c(1, 2), nrow = getM(f_output) + 1,
ncol = 2)[1:getM(f_output),]
swapElements(f_output, index)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.