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 (\chi^2(d_1), \chi^2(d_2), \chi^2(d_3)) when the degrees of freedom (d_1, d_2, d_3) 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 ceiling(df) if non-integer.

corr_mat

the target correlation matrix; negative elements will be set to 0.

Details

It is generally hard to sample from (\chi^2(d_1), \chi^2(d_2), \chi^2(d_3)) with a designed correlation matrix. In the algorithm, we approximate the random vector by (z^T Q_1 z, z^T Q_2 z, z^T Q_3 z) where z is a standard norm random vector and Q_1,Q_2,Q_3 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

References

Li, H., Aue, A., Paul, D., Peng, J., & Wang, P. (2016). An adaptable generalization of Hotelling's T^2 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

[Package ARHT version 0.1.0 Index]