bvm {ridgetorus}R Documentation

Density evaluation, sampling, and parameter estimation of the bivariate sine von Mises distribution

Description

Computation of the density and normalizing constant T(\kappa_1, \kappa_2, \lambda) of the bivariate sine von Mises

f(\theta_1, \theta_2)= T(\kappa_1, \kappa_2, \lambda) \exp\{\kappa_1 \cos(\theta_1-\mu_1) + \kappa_2 \cos(\theta_2-\mu_2) + \lambda \sin(\theta_1-\mu_1) \sin(\theta_2-\mu_2)\}.

Simulation of samples from a bivariate sine von Mises.

Maximum likelihood and method of moments estimation of the parameters (\mu_1, \mu_2, \kappa_1, \kappa_2, \lambda).

Usage

d_bvm(x, mu, kappa, log_const = NULL)

const_bvm(kappa, M = 25, MC = 10000)

r_bvm(n, mu, kappa)

fit_bvm_mm(
  x,
  lower = c(0, 0, -30),
  upper = c(30, 30, 30),
  start = NULL,
  M = 25,
  hom = FALSE,
  indep = FALSE,
  ...
)

fit_bvm_mle(
  x,
  start = NULL,
  M = 25,
  lower = c(-pi, -pi, 0, 0, -30),
  upper = c(pi, pi, 30, 30, 30),
  hom = FALSE,
  indep = FALSE,
  ...
)

Arguments

x

matrix of size c(nx, 2) with the angles on which the density is evaluated.

mu

circular means of the density, a vector of length 2.

kappa

vector of length 3 with the concentrations (\kappa_1, \kappa_2) and the dependence parameter \lambda of the density.

log_const

logarithm of the normalizing constant. Computed internally if NULL (default).

M

truncation of the series expansion for computing the normalizing constant. Defaults to 25.

MC

Monte Carlo replicates for computing the normalizing constant when there is no series expansion. Defaults to 1e4.

n

sample size.

lower, upper

vectors of length 5 with the bounds for the likelihood optimizer. Default to c(-pi, -pi, 0, 0, -30) and c(pi, pi, 30, 30, 30).

start

a vector of length 5 with the initial values for the maximum likelihood optimizer. The first two entries are disregarded in fit_bvm_mm. If NULL (default), the starting values are taken from the estimation of marginal von Mises in fit_bvm_mm. In fit_bvm_mle, the method of moments estimates are employed.

hom

assume a homogeneous distribution with equal marginal concentrations? Defaults to FALSE.

indep

set the dependence parameter to zero? Defaults to FALSE.

...

further parameters passed to mleOptimWrapper.

Value

References

Mardia, K. V., Hughes, G., Taylor, C. C., and Singh, H. (2008). A multivariate von Mises with applications to bioinformatics. Canadian Journal of Statistics, 36(1):99–109. doi:10.1002/cjs.5550360110

Singh, H., Hnizdo, V., and Demchuk, E. (2002). Probabilistic model for two dependent circular variables. Biometrika, 89(3):719–723. doi:10.1093/biomet/89.3.719

Examples

## Density evaluation

mu <- c(0, 0)
kappa <- 3:1
nth <- 50
th <- seq(-pi, pi, l = nth)
x <- as.matrix(expand.grid(th, th))
const <- const_bvm(kappa = kappa)
d <- d_bvm(x = x, mu = mu, kappa = kappa, log_const = log(const))
filled.contour(th, th, matrix(d, nth, nth), col = viridisLite::viridis(31),
               levels = seq(0, max(d), l = 30))

## Sampling and estimation

n <- 100
samp <- r_bvm(n = n, mu = mu, kappa = kappa)
(param_mm <- fit_bvm_mm(samp)$par)
(param_mle <- fit_bvm_mle(samp)$par)

[Package ridgetorus version 1.0.2 Index]