mmd: Compute MMD values from a table of sample sizes and relative...

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/mmd.R

Description

Compute various MMD results, typically using a table returned by the function binary_to_table with the argument relative = TRUE.

Usage

1
mmd(data, angular = c("Anscombe", "Freeman"))

Arguments

data

A table of sample sizes and frequencies

angular

Choice of a formula for angular transformation: either Anscombe or Freeman-Tukey transformation.

Value

A list with four components:

MMDMatrix

Following the presentation adopted in many research articles, a matrix filled with MMD values above the diagonal, and standard deviations of MMD below the diagonal.

MMDSym

A symmetrical matrix of MMD values, where negative values are replaced by zeroes.

MMDSignif

A matrix where any pair of traits having a significant MMD value is indicated by a star, ‘*’.

MMDpval

A matrix filled with MMD values above the diagonal, and p-values below the diagonal.

Author(s)

Frédéric Santos, frederic.santos@u-bordeaux.fr

References

de Souza, P. and Houghton, P. (1977). The mean measure of divergence and the use of non-metric data in the estimation of biological distances. Journal of Archaeological Science, 4(2), 163–169. doi: 10.1016/0305-4403(77)90063-2

Harris, E. F. and Sjøvold, T. (2004) Calculation of Smith's mean measure of divergence for intergroup comparisons using nonmetric data. Dental Anthropology, 17(3), 83–93.

Nikita, E. (2015) A critical review of the mean measure of divergence and Mahalanobis distances using artificial data and new approaches to the estimation of biodistances employing nonmetric traits. American Journal of Physical Anthropology, 157, 284–294. doi: 10.1002/ajpa.22708

See Also

start_mmd

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## Load and visualize a binary dataset:
data(toyMMD)
head(toyMMD)

## Convert this dataframe into a table of sample sizes and relative
## frequencies:
tab <- binary_to_table(toyMMD, relative = TRUE)
tab

## Compute and display a symmetrical matrix of MMD values:
mmd_out <- mmd(tab, angular = "Anscombe")
mmd_out$MMDSym

## Significant MMD values are indicated by a star:
mmd_out$MMDSignif

Example output

     Group Trait1 Trait2 Trait3 Trait4 Trait5 Trait6 Trait7 Trait8 Trait9
A_1 GroupA      1     NA      1      1     NA      0     NA      1      0
A_2 GroupA     NA     NA      1     NA     NA     NA     NA     NA      1
A_3 GroupA     NA      1      1      0      0      1      0      1     NA
A_4 GroupA      1      1      0      0      0     NA      1      1      0
A_5 GroupA      1      1      1      1     NA      0      1     NA      1
A_6 GroupA     NA      1      0      0     NA      1      0     NA      1
                Trait1     Trait2     Trait3     Trait4      Trait5     Trait6
N_GroupA    10.0000000 22.0000000 36.0000000 39.0000000 20.00000000 23.0000000
N_GroupB     8.0000000 21.0000000 21.0000000 20.0000000 19.00000000 17.0000000
N_GroupC    27.0000000 18.0000000 27.0000000 25.0000000 19.00000000 26.0000000
N_GroupD    15.0000000 35.0000000 30.0000000 39.0000000 29.00000000 30.0000000
N_GroupE    15.0000000 21.0000000 21.0000000 24.0000000 22.00000000 20.0000000
Freq_GroupA  0.8000000  0.7272727  0.8055556  0.6153846  0.00000000  0.6521739
Freq_GroupB  0.8750000  0.5714286  0.9523810  0.6000000  0.00000000  0.8823529
Freq_GroupC  0.6296296  0.6111111  0.5925926  0.5600000  0.00000000  0.5384615
Freq_GroupD  0.3333333  0.8857143  0.6333333  0.3589744  0.06896552  0.4000000
Freq_GroupE  0.4666667  0.5714286  0.7142857  0.6250000  0.00000000  0.8000000
                Trait7     Trait8     Trait9
N_GroupA    19.0000000 10.0000000 19.0000000
N_GroupB    17.0000000 13.0000000 20.0000000
N_GroupC    31.0000000 17.0000000 36.0000000
N_GroupD    35.0000000 14.0000000 19.0000000
N_GroupE    22.0000000 11.0000000 38.0000000
Freq_GroupA  0.3157895  0.8000000  0.5263158
Freq_GroupB  1.0000000  0.6923077  0.5000000
Freq_GroupC  0.6451613  0.5882353  0.7500000
Freq_GroupD  0.8571429  0.4285714  0.5789474
Freq_GroupE  0.5000000  0.3636364  0.4473684
         GroupA   GroupB   GroupC   GroupD   GroupE
GroupA 0.000000 0.254892 0.045187 0.302593 0.069479
GroupB 0.254892 0.000000 0.218251 0.365489 0.240835
GroupC 0.045187 0.218251 0.000000 0.088183 0.033557
GroupD 0.302593 0.365489 0.088183 0.000000 0.167865
GroupE 0.069479 0.240835 0.033557 0.167865 0.000000
       GroupA GroupB  GroupC  GroupD  GroupE 
GroupA NA     "0.255" "0.045" "0.303" "0.069"
GroupB "*"    NA      "0.218" "0.365" "0.241"
GroupC "NS"   "*"     NA      "0.088" "0.034"
GroupD "*"    "*"     "*"     NA      "0.168"
GroupE "NS"   "*"     "NS"    "*"     NA     

AnthropMMD documentation built on July 20, 2020, 5:07 p.m.