Generate a Matrix from a Latent Matrix with Added Noise
Source:R/simlr_nhanes.R
matrix_from_latent.Rd
This function generates a new matrix by applying a random linear transformation to a given latent matrix and adding Gaussian noise.
Value
A numeric matrix of dimensions (n x target_p), generated from the latent matrix with a random linear transformation and added Gaussian noise.
Examples
latent <- matrix(rnorm(20), nrow = 5, ncol = 4)
generated_matrix <- matrix_from_latent(latent, target_p = 3, noise_sd = 0.2)
print(generated_matrix)
#> [,1] [,2] [,3]
#> [1,] -0.8420428 -2.26384990 -1.4360201
#> [2,] -1.4226564 0.01670062 2.9901238
#> [3,] -3.9410985 -6.29693119 4.4003814
#> [4,] 2.4102664 1.54497778 -0.5047176
#> [5,] -1.5365092 0.60855535 0.2409585