R/helper-cov.r
cov_pool.RdFor the matrix x, we compute the MLE for the population covariance
matrix under the assumption that the data are sampled from \(K\)
multivariate normal populations having equal covariance matrices.
cov_pool(x, y)
| x | data matrix with |
|---|---|
| y | class labels for observations (rows) in |
pooled sample covariance matrix of size \(p \times p\)
cov_pool(iris[, -5], iris$Species)#> Sepal.Length Sepal.Width Petal.Length Petal.Width #> Sepal.Length 0.25970800 0.09086667 0.16416400 0.03763333 #> Sepal.Width 0.09086667 0.11308000 0.05413867 0.03205600 #> Petal.Length 0.16416400 0.05413867 0.18148400 0.04181200 #> Petal.Width 0.03763333 0.03205600 0.04181200 0.04104400