Skip to contents

The function generates simulated data for Ridge Redundancy Analysis (RDA). It creates two data matrices, X and Y, based on a set of shared latent variables H. The function adds noise to the data and returns a list containing the matrices X, Y, the latent variables H, and the regression coefficients theta.y used for generating Y.

Usage

rdasim1(n, p, q, k, s2n = c(5, 5))

Arguments

n

The number of samples.

p

The number of variables of X.

q

The number of variables of Y.

k

The number of latent variables.

s2n

The numeric parameters of signal to noise ratio for X and Y, default value is c(1,1).

Value

A list containing matrices X, Y, H, and theta.y.

Examples

# Example usage of rdasim1
set.seed(10)
sim_data <- rdasim1(n = 10, p = 5, q = 3, k = 2)
str(sim_data)
#> List of 4
#>  $ X      : num [1:10, 1:5] -3.44 -1.58 1.87 -1.7 -2.55 ...
#>  $ Y      : num [1:10, 1:3] -0.0597 0.3098 -1.0731 -0.5946 -0.1006 ...
#>  $ H      : num [1:10, 1:2] 0.0187 -0.1843 -1.3713 -0.5992 0.2945 ...
#>  $ theta.y: num [1:2, 1:3] 0.593 -0.223 0.713 0.717 0.44 ...