Learn R Programming

mmtdiff (version 1.0.0)

mvtdiff_distributions: Distribution Functions for Multivariate Approximated t-Difference

Description

Distribution Functions for Multivariate Approximated t-Difference

Usage

dmvtdiff(x, mm_result, log = FALSE)

pmvtdiff(q, mm_result, lower.tail = TRUE)

rmvtdiff(n, mm_result)

Value

For dmvtdiff: Numeric vector of density values. For pmvtdiff: Numeric scalar of cumulative probability. For rmvtdiff: Matrix of random samples (n x p).

Arguments

x

Matrix of quantiles (n x p) or vector for single point

mm_result

Result from mm_tdiff_multivariate_general()

log

Logical; if TRUE, returns log density

q

Vector of quantiles (length p) for cumulative probability

lower.tail

Logical; if TRUE (default), probabilities are P(X <= x)

n

Number of observations

Details

These functions implement the distribution functions for the approximated multivariate t-difference based on Theorem 3 from the paper.

**Note on degrees of freedom:**

  • dmvtdiff uses the exact (non-integer) nu_star from the paper

  • pmvtdiff rounds nu_star to the nearest integer due to mvtnorm::pmvt requirements. This introduces minimal approximation error when nu_star > 10 (the recommended range).

  • rmvtdiff uses the exact (non-integer) nu_star

Examples

Run this code
# Setup
Sigma1 <- matrix(c(1, 0.3, 0.3, 1), 2, 2)
Sigma2 <- matrix(c(1.5, 0.5, 0.5, 1.2), 2, 2)
result <- mm_tdiff_multivariate_general(
  mu1 = c(0, 1), Sigma1 = Sigma1, nu1 = 10,
  mu2 = c(0, 0), Sigma2 = Sigma2, nu2 = 15
)

# Density at a point
dmvtdiff(c(0, 1), result)

# Density at multiple points
x_mat <- matrix(c(0, 1, -1, 0.5), nrow = 2, byrow = TRUE)
dmvtdiff(x_mat, result)

# Cumulative probability
pmvtdiff(c(0, 1), result)

# Random samples
samples <- rmvtdiff(100, result)
head(samples)

Run the code above in your browser using DataLab