calc_mv_dist | R Documentation |
For a data matrix, compute the sample variance-covariance, which is used to compute the Mahalanobis distance.
calc_mv_dist(x)
x |
multivariate data set |
This is useful for checking distance arise from a multivariate normal sample.
vector of length n
require(ggplot2)
require(tibble)
data(aflw)
aflw_std <- apply(aflw[,7:35], 2, function(x)
(x-mean(x, na.rm=TRUE))/
sd(x, na.rm=TRUE))
d <- calc_mv_dist(aflw_std[,c("goals","behinds",
"kicks","disposals")])
d <- as_tibble(d, .name_repair="minimal")
ggplot(d, aes(x=value)) + geom_histogram()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.