r3chisq {ARHT} | R Documentation |
3-variate positively correlated chi-squared sample generation when degrees of freedom are large
Description
Generate samples approximately from three positively correlated chi-squared random variables
when the degrees of freedom
are large.
Usage
r3chisq(size, df, corr_mat)
Arguments
size |
sample size. |
df |
the degree of freedoms of the marginal distributions. Must be non-negative, but can be non-integer.
The function uses |
corr_mat |
the target correlation matrix; negative elements will be set to 0. |
Details
It is generally hard to sample from with a designed correlation matrix.
In the algorithm, we approximate the random vector by
where
is a standard norm random vector and
are diagonal matrices
with diagonal elements 1's and 0's. The designed positive correlations is approximated by carefully
selecting common locations of 1's on the diagonals. The generated sample may have slightly larger marginal degrees
of freedom than the inputted
df
, also slightly different covariances.
Value
sample
: asize
-by-3 matrix contains the generated sample.approx_cov
: the true covariance matrix ofsample
.
References
Li, H., Aue, A., Paul, D., Peng, J., & Wang, P. (2016).
An adaptable generalization of Hotelling's
test in high dimension. arXiv preprint <arXiv:1609.08725>.
Examples
set.seed(10086)
cor_examp = matrix(c(1,1/6,2/3,1/6,1,2/3,2/3,2/3,1),3,3)
a_sam = r3chisq(size = 10000,
df = c(80,90,100),
corr_mat = cor_examp)
cov(a_sam$sample) - a_sam$approx_cov
cov2cor(a_sam$approx_cov) - cor_examp