R/simul_data_complete.R
simul_data_complete.Rd
This function generates a single multivariate response value \(\boldsymbol{Y}\) and a vector of explinatory variables \((X_1,\ldots,X_{totdim})\) drawn from a model with a given number of latent components.
simul_data_complete(totdim, ncomp)
totdim | Number of columns of the X vector (from |
---|---|
ncomp | Number of latent components in the model (from 2 to 6) |
Vector of explanatory variables
Dimension of the response \(\boldsymbol{Y}\)
See Li et al.
See Li et al.
See Li et al.
See Li et al.
See Li et al.
See Li et al.
See Li et al.
This function should be combined with the replicate function to give rise to a larger dataset. The algorithm used is a port of the one described in the article of Li which is a multivariate generalization of the algorithm of Naes and Martens.
The value of \(r\) depends on the value of ncomp
:
ncomp | \(r\) |
2 | 3 |
3 | 3 |
4 | 4 |
T. Naes, H. Martens, Comparison of prediction methods for
multicollinear data, Commun. Stat., Simul. 14 (1985) 545-576.
Morris, Elaine B. Martin, Model selection for partial least squares
regression, Chemometrics and Intelligent Laboratory
Systems 64 (2002) 79-89, doi: 10.1016/S0169-7439(02)00051-5
.
simul_data_YX
for data simulation purpose
Frédéric Bertrand
frederic.bertrand@utt.fr
https://fbertran.github.io/homepage/
simul_data_complete(20,6)#> $simX #> [,1] [,2] [,3] [,4] [,5] [,6] [,7] #> [1,] 1.06026 3.060016 -4.412221 1.855302 0.02270858 2.112338 -5.478201 #> [,8] [,9] [,10] [,11] [,12] [,13] [,14] #> [1,] 0.9034829 0.06598639 3.469032 -0.6272145 -1.54431 1.745336 -3.769279 #> [,15] [,16] [,17] [,18] [,19] [,20] #> [1,] 0.04506222 3.448064 -0.6301517 -1.561319 1.77159 -3.770886 #> #> $HH #> [1] 4 #> #> $eta #> eta61 eta62 eta63 eta64 eta65 eta66 #> [1,] 0.5 0.5 0.5 0.5 0.5 0.5 #> [2,] 0.5 0.5 0.5 0.5 0.5 0.5 #> [3,] 0.5 0.5 0.5 0.5 0.5 0.5 #> [4,] 0.5 0.5 0.5 0.5 0.5 0.5 #> #> $r #> [1] -0.50302685 -7.84362840 6.70449111 4.79369856 1.87219614 0.09247717 #> #> $epsilon #> [1] -0.002473154 -0.005267429 0.021098320 -0.001542625 0.006945066 #> [6] 0.001547163 0.002088290 0.001130647 0.007838899 0.012400744 #> [11] 0.009294536 -0.005254007 -0.021615677 0.011767877 -0.013085273 #> [16] -0.008567859 0.006357350 -0.022263091 0.004638206 0.010161350 #> #> $ksi #> ksi1 ksi2 ksi3 ksi4 ksi5 ksi6 #> [1,] 0.2236068 0.2672612 0.25 0.2236068 0.2672612 0.25 #> [2,] 0.2236068 -0.2672612 0.25 -0.2236068 0.2672612 -0.25 #> [3,] 0.2236068 0.2672612 -0.25 -0.2236068 0.2672612 0.25 #> [4,] 0.2236068 -0.2672612 -0.25 0.2236068 0.2672612 -0.25 #> [5,] 0.2236068 0.2672612 0.25 0.2236068 -0.2672612 -0.25 #> [6,] 0.2236068 -0.2672612 0.25 -0.2236068 -0.2672612 0.25 #> [7,] 0.2236068 0.2672612 -0.25 -0.2236068 -0.2672612 -0.25 #> [8,] 0.2236068 -0.2672612 -0.25 0.2236068 -0.2672612 0.25 #> [9,] 0.2236068 -0.1336306 -0.25 0.2236068 -0.1336306 -0.25 #> [10,] 0.2236068 -0.1336306 0.25 0.2236068 -0.1336306 0.25 #> [11,] 0.2236068 0.2672612 0.00 0.2236068 0.2672612 0.00 #> [12,] 0.2236068 -0.1336306 -0.25 -0.2236068 0.1336306 0.25 #> [13,] 0.2236068 -0.1336306 0.25 -0.2236068 0.1336306 -0.25 #> [14,] 0.2236068 0.2672612 0.00 -0.2236068 -0.2672612 0.00 #> [15,] 0.2236068 -0.1336306 -0.25 0.2236068 -0.1336306 -0.25 #> [16,] 0.2236068 -0.1336306 0.25 0.2236068 -0.1336306 0.25 #> [17,] 0.2236068 0.2672612 0.00 0.2236068 0.2672612 0.00 #> [18,] 0.2236068 -0.1336306 -0.25 -0.2236068 0.1336306 0.25 #> [19,] 0.2236068 -0.1336306 0.25 -0.2236068 0.1336306 -0.25 #> [20,] 0.2236068 0.2672612 0.00 -0.2236068 -0.2672612 0.00 #> #> $crossksi #> ksi1 ksi2 ksi3 ksi4 ksi5 ksi6 #> ksi1 1.000000e+00 0.000000e+00 0 1.387779e-17 1.387779e-17 0 #> ksi2 0.000000e+00 1.000000e+00 0 0.000000e+00 -1.387779e-17 0 #> ksi3 0.000000e+00 0.000000e+00 1 0.000000e+00 0.000000e+00 0 #> ksi4 1.387779e-17 0.000000e+00 0 1.000000e+00 0.000000e+00 0 #> ksi5 1.387779e-17 -1.387779e-17 0 0.000000e+00 1.000000e+00 0 #> ksi6 0.000000e+00 0.000000e+00 0 0.000000e+00 0.000000e+00 1 #> #> $f #> [1] 0.0381026486 0.0216546430 -0.0425901405 -0.0011890025 0.0007482453 #> [6] 0.0002478923 #> #> $z #> [1] -0.46492420 -7.82197375 6.66190097 4.79250956 1.87294438 0.09272506 #> #> $Y #> [,1] [,2] [,3] [,4] #> [1,] 2.611909 2.547607 2.606594 2.574473 #>dimX <- 6 Astar <- 2 simul_data_complete(dimX,Astar)#> $simX #> [,1] [,2] [,3] [,4] [,5] [,6] #> [1,] -0.5482509 -0.5432202 0.5972068 -0.5327074 -0.5391291 0.5942088 #> #> $HH #> [1] 3 #> #> $eta #> eta21 eta22 #> [1,] 0.4082483 0.0000000 #> [2,] 0.8164966 0.4472136 #> [3,] 0.4082483 -0.8944272 #> #> $r #> [1] -0.3874627 1.3288243 #> #> $epsilon #> [1] -0.006471384 -0.001440722 -0.011809249 0.009072156 0.002650392 #> [6] -0.014807232 #> #> $ksi #> ksi1 ksi2 #> [1,] 0.4082483 -0.2886751 #> [2,] 0.4082483 -0.2886751 #> [3,] 0.4082483 0.5773503 #> [4,] 0.4082483 -0.2886751 #> [5,] 0.4082483 -0.2886751 #> [6,] 0.4082483 0.5773503 #> #> $crossksi #> ksi1 ksi2 #> ksi1 1 0 #> ksi2 0 1 #> #> $f #> [1] -0.1830176 -0.1290406 #> #> $z #> [1] -0.5704803 1.1997837 #> #> $Y #> [,1] [,2] [,3] #> [1,] -0.267157 0.06555643 -1.317072 #>dimX <- 6 Astar <- 3 simul_data_complete(dimX,Astar)#> $simX #> [,1] [,2] [,3] [,4] [,5] [,6] #> [1,] -2.224627 -2.048888 -16.38738 -2.243378 -2.054283 -16.39231 #> #> $HH #> [1] 3 #> #> $eta #> eta31 eta32 eta33 #> [1,] 0.4082483 0.0000000 -0.9128709 #> [2,] 0.8164966 0.4472136 0.3651484 #> [3,] 0.4082483 -0.8944272 0.1825742 #> #> $r #> [1] -16.8923041 -16.4574340 0.1714454 #> #> $epsilon #> [1] 0.006498340 0.010792021 0.010580756 -0.012252740 0.005396356 #> [6] 0.005645281 #> #> $ksi #> ksi1 ksi2 ksi3 #> [1,] 0.4082483 -0.2886751 -0.5 #> [2,] 0.4082483 -0.2886751 0.5 #> [3,] 0.4082483 0.5773503 0.0 #> [4,] 0.4082483 -0.2886751 -0.5 #> [5,] 0.4082483 -0.2886751 0.5 #> [6,] 0.4082483 0.5773503 0.0 #> #> $crossksi #> ksi1 ksi2 ksi3 #> ksi1 1 0 0 #> ksi2 0 1 0 #> ksi3 0 0 1 #> #> $f #> [1] 0.004308391 0.032973494 0.032566475 #> #> $z #> [1] -16.8879957 -16.4244605 0.2040119 #> #> $Y #> [,1] [,2] [,3] #> [1,] -7.110327 -21.06778 7.788813 #>dimX <- 6 Astar <- 4 simul_data_complete(dimX,Astar)#> $simX #> [,1] [,2] [,3] [,4] [,5] [,6] #> [1,] 4.211792 -0.1688283 14.90254 0.6037496 -3.774891 11.31224 #> #> $HH #> [1] 4 #> #> $eta #> eta41 eta42 eta43 eta44 #> [1,] 0.4082483 0.0000000 0.0000000 -0.9128709 #> [2,] 0.8164966 0.4472136 0.1825742 0.3651484 #> [3,] 0.4082483 -0.8944272 -0.3651484 0.1825742 #> [4,] 0.0000000 0.4472136 -0.9128709 0.0000000 #> #> $r #> [1] 11.044762 14.892826 -4.375129 4.400491 #> #> $epsilon #> [1] 0.0179179644 0.0124265112 -0.0013332675 0.0028616024 -0.0006504671 #> [6] 0.0013477424 #> #> $ksi #> ksi1 ksi2 ksi3 ksi4 #> [1,] 0.4082483 -0.2886751 -0.5 0.4082483 #> [2,] 0.4082483 -0.2886751 0.5 0.4082483 #> [3,] 0.4082483 0.5773503 0.0 0.4082483 #> [4,] 0.4082483 -0.2886751 -0.5 -0.4082483 #> [5,] 0.4082483 -0.2886751 0.5 -0.4082483 #> [6,] 0.4082483 0.5773503 0.0 -0.4082483 #> #> $crossksi #> ksi1 ksi2 ksi3 ksi4 #> ksi1 1.000000e+00 0 0 -5.551115e-17 #> ksi2 0.000000e+00 1 0 0.000000e+00 #> ksi3 0.000000e+00 0 1 0.000000e+00 #> ksi4 -5.551115e-17 0 0 1.000000e+00 #> #> $f #> [1] 0.273126924 -0.109400697 0.006242271 0.004362657 #> #> $z #> [1] 11.317889 14.783426 -4.368887 4.404854 #> #> $Y #> [,1] [,2] [,3] [,4] #> [1,] 0.6092864 16.66938 -6.147391 10.59473 #>