Covariance: To TableOfReal (random sampling)...

Generate a TableOfReal object by random sampling from a multi-variate normal distribution whose Covariance matrix is the selected object.

## Setting

Number of data points
  determines the number of data points that will be generated. Each data point occupies one row in the generated table.

## Algorithm

The algorithm proceeds as follows:

  1. Diagonalize the covariance matrix: calculate the eigenvalues `v` i and eigenvectors ei of the m × m Covariance matrix. In general there will also be m of these. Let E be the m × m matrix with eigenvector ej in column j (j=1..m).
  2. Generate a vector x whose elements xk equal xk = randomGauss (0, √ (vk)). Each xk is a random deviate drawn from a Gaussian distribution with mean zero and standard deviation equal to the square root of the corresponding eigenvalue vk.
  3. Rotate back: calculate the vector y = E x, obtained by multiplying the vector x with the matrix E.
  4. Add the centroid to y and copy the elements of y to the corresponding row of the TableOfReal object.
  5. Repeat steps 2, 3 and 4 until the desired number of data points has been reached.
  6. Copy the column labels from the Covariance object to the TableOfReal object.

In case the covariance matrix is diagonal, the algorithm is much simpler: we can skip the first and third step.

### Links to this page

- GaussianMixture: To TableOfReal (random sampling)...
- What was new in 3.9?