mahalanobisDist-package: Mahalanobis Distance Between Samples with p-Values by Group...

Description Details Author(s) References See Also Examples

Description

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

Details

Package: mahalanobisDist
Type: Package
Version: 0.99.2
Date: 2015-07-06

Author(s)

Murilo Guimaraes Borges and Benilton de Sa Carvalho.

Maintainer: Murilo G. Borges, murilogborges@hotmail.com.

References

Mahalanobis, P.C.: On the generalized distance in statistics. Proceedings of the National Institute of Sciences (Calcutta) 2 49-55 (1936).

See Also

colMedians, mahDis, permutationPvalue.

Examples

 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)

mgborges/mahalanobisDist documentation built on May 22, 2019, 8:53 p.m.