mcmcBatscheletMixture: MCMC sampling for Batschelet-type distributions.

Description Usage Arguments Value Examples

View source: R/mcmcBatschelet.R

Description

MCMC sampling for Batschelet-type distributions.

Usage

1
2
3
4
5
6
7
8
mcmcBatscheletMixture(x, Q = 1000, burnin = 0, thin = 1,
  n_comp = 4, bat_type = "inverse", init_pmat = matrix(NA, n_comp,
  4), fixed_pmat = matrix(NA, n_comp, 4), joint_kp_lam = FALSE,
  kp_bw = 1, lam_bw = 0.05, mu_logprior_fun = function(mu) -log(2 *
  pi), kp_logprior_fun = function(kp) 1,
  lam_logprior_fun = function(lam) -log(2), alph_prior_param = rep(1,
  n_comp), compute_variance = TRUE, compute_waic = FALSE,
  verbose = 0)

Arguments

x

A numeric vector of angles, in radians

Q

Integer; The number of iterations to return after taking burn in and thinning into account.

burnin

Integer; The number of (non-thinned) iterations to discard. No burn in is performed by default.

thin

Integer; Number of iterations to sample for each saved iteration. Defaults to 1, which means no thinning.

n_comp

Integer; Fixed number of components to estimate.

bat_type

Either 'inverse' or 'power', the type of distribution to fit. The two distributions are similar, but the power Batschelet distribution is computationally much less demanding.

init_pmat

A numeric matrix with n_comp rows and four columns, corresponding to μ, κ, λ, α, in that order. Gives starting values for the parameters. If any element is NA, it will be given a default starting value. For mu, the default starting values are equally spaced on the circle. For κ, the default starting value is 5. For λ, the default starting value is 0, which corresponds to the von Mises distribution. For α, the default starting value is 1/n_comp.

fixed_pmat

A numeric matrix with n_comp rows and four columns, corresponding to μ, κ, λ, α, in that order. Any element that is not NA in this matrix will be held constant at the given value and not sampled.

joint_kp_lam

Logical; If TRUE, the parameters kp and lam are drawn jointly. This can be beneficial if these are strongly correlated.

kp_bw

Numeric; A tuning parameter for kappa proposals. If kp_bw == 1, the chi-square distribution is used. Often, this distribution is too wide, so this parameter can be set to 0 < kp_bw < 1 to use a gamma proposal which has lower variance than the chi-square.

lam_bw

Numeric; the maximum distance from the current lambda at which uniform proposals are drawn.

mu_logprior_fun

Function; A function with a single argument, which returns the log of the prior probability of μ. Defaults to a uniform prior function.

kp_logprior_fun

Function; A function with a single argument, which returns the log of the prior probability of κ. Defaults to a uniform prior function. In contrast to the other parameters, for κ the constant (uniform) prior is improper.

lam_logprior_fun

Function; A function with a single argument, which returns the log of the prior probability of λ. Defaults to a uniform prior function.

alph_prior_param

Integer vector; The mixture weight parameter vector α is given its conjugate Dirichlet prior. The default is rep(1, n_comp), which is the noninformative uniform prior over the n_comp simplex.

compute_variance

Logical; Whether to add circular variance to the returned mcmc sample.

compute_waic

Logical; Whether to compute the WAIC. Can be computationally demanding if n * Q is large.

verbose

Integer up to 4; Determines the amount of printed debug information.

Value

A numeric matrix of sampled parameter values.

Examples

1
2
x <- rinvbatmix(100)
mcmcBatscheletMixture(x, Q = 10)

keesmulder/flexcircmix documentation built on May 29, 2019, 3:02 a.m.