mcmcpermute: Permute MCMC samples

Description Usage Arguments Details Value See Also Examples

Description

Calling mcmcpermute() on an mcmcoutput object relabels the MCMC samples by using a relabeling algorithm. "kmeans" is the standard relabeling algorithm used. For mixtures of Poisson and Binomial distributions there are also the relabeling algorithms "Stephens1997a" of Stephens (1997a) and "Stephens1997b" of Stephens (1997b) available. For Exponential mixture models only the alternative "Stephens1997b" is available. Note that the argument opt_ctrl is a relict from older versions and deprecated. In future versions this argument will be removed from the R function.

Usage

1
2
3
4
5
6
mcmcpermute(
  mcmcout,
  fdata = NULL,
  method = "kmeans",
  opt_ctrl = list(max_iter = 200L)
)

Arguments

mcmcout

An mcmcoutput object containing the MCMC samples.

fdata

An fdata object containing the observations and in case of fixed indicator models the indicators. This argument is optional for relabeling with the "kmeans" or "Stephens1997a" methods, but mandatory for relabeling with Stephens1997b".

method

A character indicating which relabeling method should be used. The relabeling method "kmeans" is the default. "Stephens1997a" and "Stephens1997b" are only available for mixtures of Poisson or Binomial distributions.

opt_ctrl

(Deprecated) A list containing hyperparameters for optimization with the "Stephens1997a" relabeling algorithm.

Details

Relabeling of the MCMC samples is performed to assign each MCMC draw to its "right" component as in MCMC sampling the components are from time to time permuted or, if random permutation sampling was used, samples were intentionally permuted. This results ususally in multimodal posterior distributions. To reassign each draw to its potentially correct component, a relabeling algorithm is used (see Frühwirth-Schnatter (2006) as well as Stephens (1997a) and Stephens (1997b)).

Relabeling is performed on the point process of the component parameters and parameter pairs which are both assigned to the same component get removed from the resulting MCMC sample. Note that this results usually in a reduced number of MCMC samples. the returned object is of class mcmcoutputperm and carries the samples and statistics (like log-likelihood values) of the permuted samples.

Value

An mcmcoutputperm object containing the relabeld MCMC samples.

See Also

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# Define a mixture model.
f_model <- model("poisson", par = list(lambda = c(0.3, 1.2)), K = 2)
# Simulate data from the mixture 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)
# Relabel the MCMC samples.
f_outputperm <- mcmcpermute(f_output)
f_outputperm

simonsays1980/finmix documentation built on Dec. 23, 2021, 2:25 a.m.