Description Details Author(s) References See Also Examples
This comparison method combines multidimensional scaling (MDS) data with permutation tests. Our strategy uses MDS to project the data onto lower dimensions, while preserving the distance between the data points. Using these projections, we determine the Mahalanobis distance between the groups and estimates the null distribution of the distances between the groups using permutation. The strategy uses this distribution to assess the evidences of differences between the groups
Package: | mahalanobisDist |
Type: | Package |
Version: | 0.99.2 |
Date: | 2015-07-06 |
Murilo Guimaraes Borges and Benilton de Sa Carvalho.
Maintainer: Murilo G. Borges, murilogborges@hotmail.com.
Mahalanobis, P.C.: On the generalized distance in statistics. Proceedings of the National Institute of Sciences (Calcutta) 2 49-55 (1936).
colMedians, mahDis, permutationPvalue
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | # Creation of our data and groups
observations <- 60
data <- rbind(matrix(rexp(observations/2, rate=1), ncol = 2),
matrix(rexp(observations/2, rate=0.5), ncol = 2))
group <- c(rep("A", observations/4), rep("B", observations/4))
# Number of the desired replications to calculate p-values
replication <- 10000
# Function in use
realDist <- mahDis(data, group)
pvalue <- permutationPvalue(replication, data, group)
realDist; pvalue
# The p-values estimated by the null distribution of the distances between the groups using permutation
distVector <- replicate(replication, {mahDis (data, sample(group))})
hist(distVector)
abline(v=realDist, col=2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.