Simulate a mixture of Spherical Gaussians
generate_mixture_gaussians.RdSimulate a mixture of Spherical Gaussians
Arguments
- n
number of samples
- means
a matrix with
pcolumns andkrows (for the number of clusters), where each row represents the mean of a Spherical Gaussian- covariances
a list of
kppositive definite matrices- proportions
a non-negative vector of length
kthat sums to 1, where each value denotes the relative proportion of each cluster
Examples
n <- 500
means <- matrix(c(0, 0, 5, 5), ncol = 2, byrow = TRUE)
covariances <- list(diag(2),
diag(2))
proportions <- c(0.5, 0.5)
data <- generate_mixture_gaussians(n, means, covariances, proportions)
head(data)
#> [,1] [,2]
#> [1,] 5.6693782 6.4887322
#> [2,] 0.5025622 -0.1164599
#> [3,] 5.1609689 4.8101607
#> [4,] 3.4927390 3.9106904
#> [5,] -0.9871484 -1.7914358
#> [6,] 5.1216938 5.3710895