AM_mcmc_fit: Performs a Gibbs sampling

Description Usage Arguments Details Value Examples

View source: R/AM_mcmc.R

Description

The AM_mcmc_fit function performs a Gibbs sampling in order to estimate the mixture comprising the sample data y. The mixture selected must be of a predefined type mix_kernel_hyperparams (defined with AM_mix_hyperparams_* functions, where star * denotes the chosen kernel). Additionally, a prior distribution on the number of mixture components must be specified through mix_components_prior (generated with AM_mix_components_prior_* functions, where * denotes the chosen prior). Similarly, a prior on the weights of the mixture should be specified through mix_weight_prior (defined with AM_mix_weights_prior_* functions). Finally, with mcmc_parameters, the user sets the MCMC parameters for the Gibbs sampler (defined with AM_mcmc_parameters functions).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
AM_mcmc_fit(
  y,
  mix_kernel_hyperparams,
  initial_clustering = NULL,
  init_K = NULL,
  fixed_clustering = NULL,
  mix_components_prior = AM_mix_components_prior_pois(),
  mix_weight_prior = AM_mix_weights_prior_gamma(),
  mcmc_parameters = AM_mcmc_parameters()
)

Arguments

y

input data, can be a vector or a matrix.

mix_kernel_hyperparams

is a configuration list, defined by *_mix_hyperparams functions, where * denotes the chosen kernel. See AM_mix_hyperparams_multiber, AM_mix_hyperparams_multinorm, AM_mix_hyperparams_uninorm, AM_mix_hyperparams_unipois for more details.

initial_clustering

is a vector CI of initial cluster assignement. If no clustering is specified (either as init_K or init_clustering), then every observation is assigned to its own cluster.

init_K

initial value for the number of cluster. When this is specified, AntMAN intitialises the clustering assign usng K-means.

fixed_clustering

if specified, this is the vector CI containing the cluster assignments. This will remain unchanged for every iteration.

mix_components_prior

is a configuration list defined by AM_mix_components_prior_* functions, where * denotes the chosen prior. See AM_mix_components_prior_dirac,
AM_mix_components_prior_negbin, AM_mix_components_prior_pois for more
details.

mix_weight_prior

is a configuration list defined by AM_weight_prior_* functions, where * denotes the chosen prior specification. See AM_mix_weights_prior_gamma for more
details.

mcmc_parameters

is a configuration list defined by AM_mcmc_parameters. See AM_mcmc_parameters for more details.

Details

If no initial clustering is specified (either as init_K or init_clustering), then every observation is allocated to a different cluster. If init_K is specified then AntMAN initialises the clustering through K-means.

Warning: if the user does not specify init_K or initial_cluster, the first steps can be be time-consuming because of default setting of the initial clustering.

Value

The return value is an AM_mcmc_output object.

Examples

1
2
3
 AM_mcmc_fit( AM_sample_unipois()$y, 
              AM_mix_hyperparams_unipois (alpha0=2, beta0=0.2), 
              mcmc_parameters = AM_mcmc_parameters(niter=50, burnin=0, thin=1, verbose=0))

AntMAN documentation built on July 23, 2021, 5:08 p.m.

Related to AM_mcmc_fit in AntMAN...