AM_mcmc_fit {AntMAN} | R Documentation |
Performs a Gibbs sampling
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
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 |
initial_clustering |
is a vector CI of initial cluster assignement. If no clustering is specified (either as |
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 |
mix_weight_prior |
is a configuration list defined by AM_weight_prior_* functions, where * denotes the chosen prior specification.
See |
mcmc_parameters |
is a configuration list defined by AM_mcmc_parameters. See |
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
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))