Description Usage Arguments Details Value References Examples
View source: R/generate_Gaussian.R
This function will generate a Gaussian distributed data set with latent variables and correlated replicates.
1 2 | generate_Gaussian(n, R, p, l, s, sparsityA, sparsityobserved, sparsitylatent, lwb,
upb, seed)
|
n |
the number of observations. |
R |
the number of replicates. |
p |
the number of observed variables. |
l |
the number of latent variables. |
s |
latent effects are generated as s piecewise constant across replicates. The number s should be a factor of R. |
sparsityA |
proportion of the number of zeros in the transition matrix A. Must be a number from 0 to 1. |
sparsityobserved |
proportion of the number of zeros in the inverse covariance of the observed variables. Must be a number from 0 to 1. |
sparsitylatent |
proportion of the number of zeros in the inverse covariances among latent variables and between observed variables and latent variables. Must be a number from 0 to 1. |
lwb |
lower bound for the elements in the inverse covariance matrix. |
upb |
upper bound for the elements in the inverse covariance matrix. |
seed |
the seed for the random number generator. |
This function aims to generate a Gaussian distributed data set with latent variables and correlated replicates. For each observation, the latent variables are piecewise constant across replicates, and conditioned on the latent variables, the replicates follow a one-lag vector autoregressive model, where the transition matrix A is sparse with non-zero elements set equal to 0.3. The matrix Σ is the covariance matrix for the observed variables X and the latent variables U, and we partition Σ into matrices that quantify the relationships among the observed variables (Σ_{XX}), between the observed variables and latent variables (Σ_{XU} or Σ_{UX}), and of the latent variables (Σ_{UU}). In general, the data is generated with:
X_{i1} | U_{i1} \sim N_p(Σ_{XU}Σ^{-1}_{UU} U_{i1}, Σ_{XX} - Σ_{XU}Σ^{-1}_{UU}Σ_{UX}),
X_{it} | X_{i(t-1)},U_{it} \sim N_p(AX_{i(t-1)} + Σ_{XU}Σ^{-1}_{UU} U_{it}, Σ_{XX} - Σ_{XU}Σ^{-1}_{UU}Σ_{UX}),
where 1 ≤ i ≤ n and 1 ≤ t ≤ R.
X |
the generated data, which is a list with n elements and each element is a matrix with R rows and p columns |
truegraph |
a matrix that encodes the conditional dependence relationships between sets of two observed variables |
Jin, Y., Ning, Y., and Tan, K. M. (2020), ‘Exponential Family Graphical Models with Correlated Replicates and Unmeasured Confounders’, preprint available.
1 2 | data <- generate_Gaussian(n = 50, R = 20, p = 30, l = 2, s = 2, sparsityA = 0.95,
sparsityobserved = 0.9, sparsitylatent = 0.2, lwb = 0.3, upb = 0.3, seed = 1)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.