bwc {ridgetorus} | R Documentation |
Density evaluation, sampling, and parameter estimation of the bivariate wrapped Cauchy distribution
Description
Computation of the density of a bivariate wrapped Cauchy:
f(\theta_1, \theta_2)=c(\xi_1,\xi_2,\rho)\{c_0(\xi_1,\xi_2,\rho)-
c_1(\xi_1,\xi_2,\rho) \cos (\theta_1-\mu_1)-
c_2(\xi_1,\xi_2,\rho)\cos (\theta_2-\mu_2)-\\
c_3(\xi_1,\xi_2,\rho) \cos (\theta_1-\mu_1) \cos (\theta_2-\mu_2)-
c_4(\xi_1,\xi_2,\rho) \sin (\theta_1-\mu_1) \sin (\theta_2-\mu_2)\}^{-1}.
Simulation of samples from a bivariate wrapped Cauchy.
Maximum likelihood and method of moments estimation of the
parameters (\mu_1, \mu_2, \xi_1, \xi_2, \rho)
.
Usage
d_bwc(x, mu, xi)
r_bwc(n, mu, xi)
fit_bwc_mm(x, hom = FALSE, indep = FALSE)
fit_bwc_mle(
x,
start = NULL,
lower = c(-pi, -pi, 0, 0, -1 + 0.001),
upper = c(pi, pi, 1 - 0.001, 1 - 0.001, 1 - 0.001),
hom = FALSE,
indep = FALSE,
...
)
Arguments
x |
matrix of size |
mu |
circular means of the density, a vector of length |
xi |
a vector of length |
n |
sample size. |
hom |
assume a homogeneous distribution with equal marginal
concentrations? Defaults to |
indep |
set the dependence parameter to zero? Defaults to |
start |
a vector of length |
lower , upper |
vectors of length |
... |
further parameters passed to
|
Value
-
d_bwc
: a vector of lengthnx
with the density evaluated atx
. -
r_bwc
: a matrix of sizec(n, 2)
with the random sample. -
fit_mme_bwc, fit_mle_bwc
: a list with the parameters(\mu_1, \mu_2, \xi_1, \xi_2, \rho)
and the objectopt
containing the optimization summary.
Author(s)
The original code for r_bwc
was supplied by
Arthur Pewsey.
References
Kato, S. and Pewsey, A. (2015). A Möbius transformation-induced distribution on the torus. Biometrika, 102(2):359–370. doi:10.1093/biomet/asv003
Examples
## Density evaluation
mu <- c(0, 0)
xi <- c(0.3, 0.5, 0.4)
nth <- 50
th <- seq(-pi, pi, l = nth)
x <- as.matrix(expand.grid(th, th))
d <- d_bwc(x = x, mu = mu, xi = xi)
filled.contour(th, th, matrix(d, nth, nth), col = viridisLite::viridis(20),
levels = seq(0, max(d), l = 20))
## Sampling and estimation
n <- 100
samp <- r_bwc(n = n, mu = mu, xi = xi)
(param_mm <- fit_bwc_mm(samp)$par)
(param_mle <- fit_bwc_mle(samp)$par)