50% off | Unlimited Data & AI Learning

Last chance! 50% off unlimited learning

Sale ends in


TRES (version 1.1.5)

MenvU_sim: Generate matrices M and U

Description

This function generates the matrices M and U with envelope structure.

Usage

MenvU_sim(
  p,
  u,
  Omega = NULL,
  Omega0 = NULL,
  Phi = NULL,
  jitter = FALSE,
  wishart = FALSE,
  n = NULL
)

Arguments

p

Dimension of p-by-p matrix M.

u

The envelope dimension. An integer between 0 and p.

Omega

The positive definite matrix Ω in M=ΓΩΓT+Γ0Ω0Γ0T. The default is Ω=AAT where the elements in A are generated from Uniform(0,1) distribution.

Omega0

The positive definite matrix Ω0 in M=ΓΩΓT+Γ0Ω0Γ0T. The default is Ω0=AAT where the elements in A are generated from Uniform(0,1) distribution.

Phi

The positive definite matrix Φ in U=ΓΦΓT. The default is Φ=AAT where the elements in A are generated from Uniform(0,1) distribution.

jitter

Logical or numeric. If it is numeric, the diagonal matrix diag(jitter, nrow(M), ncol(M)) is added to matrix M to ensure the positive definiteness of M. If it is TRUE, then it is set as 1e-5 and the jitter is added. If it is FALSE (default), no jitter is added.

wishart

Logical. If it is TRUE, the sample estimator from Wishart distribution Wp(M/n,n) and Wp(U/n,n) are generated as the output matrices M and U.

n

The sample size. If wishart is FALSE, then n is ignored.

Value

M

The p-by-p matrix M.

U

The p-by-p matrix U.

Gamma

The p-by-u envelope basis.

Details

The matrices M and U are in forms of M=ΓΩΓT+Γ0Ω0Γ0T,U=ΓΦΓT.

The envelope basis Γ is randomly generated from the Uniform (0, 1) distribution elementwise and then transformed to a semi-orthogonal matrix. Γ0 is the orthogonal completion of Γ.

In some cases, to guarantee that M is positive definite which is required by the definition of envelope, a jitter should be added to M.

If wishart is TRUE, after the matrices M and U are generated, the samples from Wishart distribution Wp(M/n,n) and Wp(U/n,n) are output as matrices M and U. If so, n is required.

References

Cook, R.D. and Zhang, X., 2018. Fast envelope algorithms. Statistica Sinica, 28(3), pp.1179-1197.

Examples

Run this code
# NOT RUN {
data1 <- MenvU_sim(p = 20, u = 5)
M1 <- data1$M
U1 <- data1$U

# Sample version from Wishart distribution
data2 <- MenvU_sim(p = 20, u = 5, wishart = TRUE, n = 200)
M2 <- data2$M
U2 <- data2$U

# }

Run the code above in your browser using DataLab