Title: | Multivariate Inverse Gaussian Distribution |
---|---|
Description: | Provides utilities for estimation for the multivariate inverse Gaussian distribution of Minami (2003) <doi:10.1081/STA-120025379>, including random vector generation and explicit estimators of the location vector and scale matrix. The package implements kernel density estimators discussed in Belzile, Desgagnes, Genest and Ouimet (2024) <doi:10.48550/arXiv.2209.04757> for smoothing multivariate data on half-spaces. |
Authors: | Frederic Ouimet [aut] , Leo Belzile [aut, cre] |
Maintainer: | Leo Belzile <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.0 |
Built: | 2024-11-12 06:50:38 UTC |
Source: | CRAN |
The density of the MIG model is
for points in the d
-dimensional half-space
dmig(x, xi, Omega, beta, shift, log = FALSE) rmig(n, xi, Omega, beta, shift, method = c("invsim", "bm"), timeinc = 0.001) pmig(q, xi, Omega, beta, log = FALSE, method = c("sov", "mc"), B = 10000L)
dmig(x, xi, Omega, beta, shift, log = FALSE) rmig(n, xi, Omega, beta, shift, method = c("invsim", "bm"), timeinc = 0.001) pmig(q, xi, Omega, beta, log = FALSE, method = c("sov", "mc"), B = 10000L)
x |
|
xi |
|
Omega |
|
beta |
|
shift |
|
log |
logical; if |
n |
number of observations |
method |
string; one of inverse system ( |
timeinc |
time increment for multivariate simulation algorithm based on the hitting time of Brownian motion, default to |
q |
|
B |
number of Monte Carlo replications for the SOV estimator |
Observations are generated using the representation as the first hitting time of a hyperplane of a correlated Brownian motion.
for dmig
, the (log)-density
for rmig
, an n
vector if d=1
(univariate) or an n
by d
matrix if d > 1
an n
vector of (log) probabilities
Frederic Ouimet (bm
), Leo Belzile (invsim
)
Leo Belzile
# Density evaluation x <- rbind(c(1, 2), c(2,3), c(0,-1)) beta <- c(1, 0) xi <- c(1, 1) Omega <- matrix(c(2, -1, -1, 2), nrow = 2, ncol = 2) dmig(x, xi = xi, Omega = Omega, beta = beta) # Random number generation d <- 5L beta <- runif(d) xi <- rexp(d) Omega <- matrix(0.5, d, d) + diag(d) samp <- rmig(n = 1000, beta = beta, xi = xi, Omega = Omega) mle <- fit_mig(samp, beta = beta, method = "mle") set.seed(1234) d <- 2L beta <- runif(d) Omega <- rWishart(n = 1, df = 2*d, Sigma = matrix(0.5, d, d) + diag(d))[,,1] xi <- rexp(d) q <- mig::rmig(n = 10, beta = beta, Omega = Omega, xi = xi) pmig(q, xi = xi, beta = beta, Omega = Omega)
# Density evaluation x <- rbind(c(1, 2), c(2,3), c(0,-1)) beta <- c(1, 0) xi <- c(1, 1) Omega <- matrix(c(2, -1, -1, 2), nrow = 2, ncol = 2) dmig(x, xi = xi, Omega = Omega, beta = beta) # Random number generation d <- 5L beta <- runif(d) xi <- rexp(d) Omega <- matrix(0.5, d, d) + diag(d) samp <- rmig(n = 1000, beta = beta, xi = xi, Omega = Omega) mle <- fit_mig(samp, beta = beta, method = "mle") set.seed(1234) d <- 2L beta <- runif(d) Omega <- rWishart(n = 1, df = 2*d, Sigma = matrix(0.5, d, d) + diag(d))[,,1] xi <- rexp(d) q <- mig::rmig(n = 10, beta = beta, Omega = Omega, xi = xi) pmig(q, xi = xi, beta = beta, Omega = Omega)
Fit multivariate inverse Gaussian distribution
fit_mig(x, beta, method = c("mle", "mom"), shift)
fit_mig(x, beta, method = c("mle", "mom"), shift)
x |
|
beta |
|
method |
string, one of |
shift |
|
a list with components:
xi
: estimate of the expectation or location vector
Omega
: estimate of the scale matrix
Absolute magnitude of 373 geomagnetic storms lasting more than 48h with absolute magnitude (dst) larger than 100 in 1957-2014.
a vector of size 373
For a detailed article presenting the derivation of the Dst index, see http://wdc.kugi.kyoto-u.ac.jp/dstdir/dst2/onDstindex.html
Aki Vehtari
World Data Center for Geomagnetism, Kyoto, M. Nose, T. Iyemori, M. Sugiura, T. Kamei (2015), Geomagnetic Dst index, doi:10.17593/14515-74000.
Given a matrix of new observations, compute the density of the multivariate
inverse Gaussian mixture defined by assigning equal weight to each component where
is the location parameter.
mig_kdens(x, newdata, Omega, beta, log = FALSE)
mig_kdens(x, newdata, Omega, beta, log = FALSE)
x |
|
newdata |
matrix of new observations at which to evaluated the kernel density |
Omega |
|
beta |
|
log |
logical; if |
value of the (log)-density at newdata
Given an n
sample from a multivariate
inverse Gaussian distribution on the half-space defined by
,
the function computes the bandwidth (
type="isotropic"
) or scale
matrix that minimizes the asymptotic mean integrated squared error away from the boundary.
The latter depend on the true unknown density, which is replaced using as plug-in
a MIG distribution evaluated at the maximum likelihood estimator. The integral or the integrated
squared error are obtained by Monte Carlo integration with N
simulations
mig_kdens_bandwidth( x, beta, shift, method = c("amise", "lcv", "lscv", "rlcv"), type = c("isotropic", "full"), approx = c("mig", "tnorm"), transformation = c("none", "scaling", "spherical"), N = 10000L, buffer = 0.25, pointwise = NULL, maxiter = 2000L, ... )
mig_kdens_bandwidth( x, beta, shift, method = c("amise", "lcv", "lscv", "rlcv"), type = c("isotropic", "full"), approx = c("mig", "tnorm"), transformation = c("none", "scaling", "spherical"), N = 10000L, buffer = 0.25, pointwise = NULL, maxiter = 2000L, ... )
x |
an |
beta |
|
shift |
location vector for translating the half-space. If missing, defaults to zero |
method |
estimation criterion, either |
type |
string indicating whether to compute an isotropic model or estimate the optimal scale matrix via optimization |
approx |
string; distribution to approximate the true density function |
transformation |
string for optional scaling of the data before computing the bandwidth. Either standardization to unit variance |
N |
integer number of simulations to evaluate the integrals of the MISE by Monte Carlo |
buffer |
double indicating the buffer from the halfspace |
pointwise |
if |
maxiter |
integer; max number of iterations in the call to |
... |
additional parameters, currently ignored |
a d
by d
scale matrix
Wu, X. (2019). Robust likelihood cross-validation for kernel density estimation. Journal of Business & Economic Statistics, 37(4), 761–770. doi:10.1080/07350015.2018.1424633 Bowman, A.W. (1984). An alternative method of cross-validation for the smoothing of density estimates, Biometrika, 71(2), 353–360. doi:10.1093/biomet/71.2.353 Rudemo, M. (1982). Empirical choice of histograms and kernel density estimators. Scandinavian Journal of Statistics, 9(2), 65–78. http://www.jstor.org/stable/4615859
Given a data matrix over a half-space defined by beta
,
compute the log density using leave-one-out cross validation,
taking in turn an observation as location vector and computing the
density of the resulting mixture.
mig_lcv(x, beta, Omega)
mig_lcv(x, beta, Omega)
x |
|
beta |
|
Omega |
|
the value of the likelihood cross-validation criterion
Given a data matrix over a half-space defined by beta
,
compute the log density using leave-one-out cross validation,
taking in turn an observation as location vector and computing the
density of the resulting mixture.
mig_rlcv(x, beta, Omega, xsamp, dxsamp)
mig_rlcv(x, beta, Omega, xsamp, dxsamp)
x |
|
beta |
|
Omega |
|
xsamp |
matrix of points at which to evaluate the integral |
dxsamp |
density of points |
the value of the likelihood cross-validation criterion