generate_X_gaussian | R Documentation |
Generate an .n
x .p
normal random matrix with the specified mean
and covariance structure.
generate_X_gaussian(.n, .p, .mean = 0, .sd = 1, .corr = 0, .Sigma = NULL)
.n |
Number of samples. |
.p |
Number of features. |
.mean |
Mean of normal distribution from which to generate data. Can be
either a scalar value or vector of length |
.sd |
Standard deviation of normal distribution from which to generate data. Default is 1. |
.corr |
Correlation between all pairs of features. Default is 0 for no correlation. |
.Sigma |
(Optional) |
A normal random matrix of size n.
x .p
.
# Returns 100 x 10 random Gaussian matrix with X_ij ~ N(0, 1) X <- generate_X_gaussian(.n = 100, .p = 10) # Returns 100 x 10 random Gaussian matrix with E(X_i) = 0 for all i, # Var(X_i) = 4 for all i, and Cor(X_i, X_j) = 0.7 for all i != j X <- generate_X_gaussian(.n = 100, .p = 10, .sd = 2, .corr = 0.7) # Returns 100 x 2 random Gaussian matrix: X ~ N(0, Sigma), where # Sigma = [3, .5; .5, 1] X <- generate_X_gaussian( .n = 100, .p = 2, .Sigma = matrix(c(3, .5, .5, 1), nrow = 2, byrow = TRUE) )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.