jaccard.test: Test for Jaccard/Tanimoto similarity coefficients

Description Usage Arguments Details Value Optional arguments for method="bootstrap" Optional arguments for method="mca" See Also Examples

View source: R/jaccard.test.R

Description

Compute statistical significance of Jaccard/Tanimoto similarity coefficients between binary vectors, using four different methods.

Usage

1
2
jaccard.test(x, y, method = "mca", px = NULL, py = NULL, verbose = TRUE,
  ...)

Arguments

x

a binary vector (e.g., fingerprint)

y

a binary vector (e.g., fingerprint)

method

a method to compute a p-value ("mca", "bootstrap", "asymptotic", or "exact")

px

probability of successes in x (optional)

py

probability of successes in y (optional)

verbose

whether to print progress messages

...

optional arguments for specific computational methods

Details

There exist four methods to compute p-values of Jaccard/Tanimoto similarity coefficients: mca, bootstrap, asymptotic, and exact. This is simply a wrapper function for corresponding four functions in this package: jaccard.test.mca, jaccard.test.bootstrap, jaccard.test.asymptotic, and jaccard.test.exact.

We recommand using either mca or bootstrap methods, since the exact solution is slow for a moderately large vector and asymptotic approximation may be inaccurate depending on the input vector size. The bootstrap method uses resampling with replacement binary vectors to compute a p-value (see optional arguments). The mca method uses the measure concentration algorithm that estimates the multinomial distribution with a known error bound (specified by an optional argument accuracy).

Value

jaccard.test returns a list mainly consisting of

statistics

centered Jaccard/Tanimoto similarity coefficient

pvalue

p-value

expectation

expectation

Optional arguments for method="bootstrap"

fix

whether to fix (i.e., not resample) x and/or y

B

a total bootstrap iteration

seed

a seed for a random number generator

Optional arguments for method="mca"

accuracy

an error bound on approximating a multinomial distribution

error.type

an error type on approximating a multinomial distribution ("average", "upper", "lower")

seed

a seed for the random number generator.

See Also

jaccard.test.bootstrap jaccard.test.mca jaccard.test.exact jaccard.test.asymptotic

Examples

1
2
3
4
5
6
7
set.seed(1234)
x = rbinom(100,1,.5)
y = rbinom(100,1,.5)
jaccard.test(x,y,method="bootstrap")
jaccard.test(x,y,method="mca")
jaccard.test(x,y,method="exact")
jaccard.test(x,y,method="asymptotic")

Example output

Bootstrap Procedures : 
100 200 300 400 500 600 700 800 900 1000 $statistics
[1] -0.02460145

$statistics.null
   [1] -0.0489180408  0.0044296788  0.0308631787 -0.0112775240 -0.0498575499
   [6]  0.0807138179 -0.0652350571  0.0191649555 -0.0263461114 -0.0436781609
  [11]  0.0026790108  0.0000000000 -0.0674151311 -0.0317304241 -0.0207655142
  [16] -0.0498575499  0.0677795031  0.0276833414  0.0368923112 -0.0035064574
  [21] -0.0009072658  0.0276833414 -0.0395869191  0.0424255297  0.0390355913
  [26]  0.0174825175 -0.0207655142 -0.0789036545 -0.0609528487  0.0379442982
  [31] -0.0089749646  0.0276833414 -0.0207402180  0.0055476529 -0.0674151311
  [36]  0.0256192450 -0.0489180408 -0.0581945229 -0.0765785938  0.0354251012
  [41] -0.0652350571  0.0795470497 -0.0149786469 -0.0149786469  0.0613074252
  [46]  0.0379442982 -0.0674151311 -0.0282605410 -0.0071239718 -0.0721366479
  [51] -0.1085311969  0.0174390102  0.0174808406 -0.0131141808  0.0073381465
  [56] -0.0226696259 -0.0341683778 -0.0457642516 -0.0246014493  0.0453050786
  [61]  0.0191649555  0.0394657976 -0.0263461114 -0.1013346163  0.0986445415
  [66]  0.0613074252 -0.0146985962  0.0140252454 -0.0900866813 -0.0560704356
  [71] -0.0539728132  0.0482624005  0.0308631787  0.0954213982 -0.0489180408
  [76]  0.0240471513 -0.0395869191  0.0548935842 -0.0247216731 -0.0089749646
  [81]  0.0409593592 -0.0247216731  0.0243882326 -0.0361925511  0.0240471513
  [86] -0.0878012048  0.0190767934 -0.0035064574  0.0095154156 -0.0718513291
  [91]  0.0108323407  0.0108323407  0.0061524144 -0.0375820310  0.0783546864
  [96]  0.0758901198 -0.0017394829  0.0609284988 -0.0131141808 -0.0017394829
 [101]  0.0452778988 -0.0188890000 -0.0531294881 -0.0149786469 -0.0856836006
 [106] -0.0108543417  0.0613074252 -0.0246014493  0.0292874396  0.0496987952
 [111]  0.0733137830  0.0677795031 -0.0539728132  0.0292874396  0.0086189206
 [116] -0.0765785938  0.0818557266  0.0191649555 -0.0510104831 -0.0053012048
 [121]  0.0867139959 -0.0089749646  0.0409593592 -0.0265610438 -0.0035064574
 [126] -0.0027433479 -0.0424279105  0.0276833414  0.0000000000  0.1523107355
 [131] -0.0436781609  0.0703239519  0.0009001153 -0.0468523724  0.0348153376
 [136]  0.0256192450  0.0256192450 -0.0035064574  0.0271644333 -0.0341683778
 [141] -0.0108543417  0.0298992890 -0.0560704356  0.0703239519 -0.0721366479
 [146] -0.0369278973 -0.0457642516  0.0240471513 -0.0053012048 -0.0375820310
 [151] -0.0428018076 -0.0027433479 -0.0609528487  0.0108323407  0.0276833414
 [156]  0.0529610014 -0.0302023558  0.0467980296 -0.0089749646 -0.0833042596
 [161] -0.0168710805  0.0339315128  0.0379442982  0.0009001153  0.0315683056
 [166]  0.0308631787  0.0157677185  0.0453050786  0.0771359700  0.0026790108
 [171]  0.0394657976  0.0108323407  0.0544231807 -0.0436781609  0.0111564042
 [176]  0.0158613373  0.0125366330  0.0482624005 -0.0468523724  0.0409593592
 [181]  0.0026790108 -0.0547273841  0.0174825175  0.0292874396 -0.0428018076
 [186] -0.0282605410  0.0276833414 -0.0603448276  0.0529610014 -0.0225988701
 [191] -0.0521809270 -0.0361925511 -0.0285484057 -0.0560704356 -0.0207655142
 [196] -0.0457642516  0.0276833414 -0.0071239718 -0.0382440232 -0.0408169680
 [201]  0.0044296788  0.0240471513  0.0453050786 -0.0265610438  0.0073381465
 [206] -0.0766935895 -0.0609528487  0.0771359700  0.0174808406  0.0363943215
 [211] -0.0403225806 -0.0489180408  0.0240471513  0.0840677966 -0.0134232320
 [216] -0.0027433479 -0.0743450390  0.0243882326  0.0900813854 -0.0302023558
 [221] -0.0361925511 -0.0552747525  0.0061524144  0.0758901198 -0.0149786469
 [226] -0.0089749646 -0.0721366479 -0.0108543417 -0.0367726584  0.0066895572
 [231]  0.1065699007  0.0226963618  0.0208204399 -0.0053012048  0.1403770767
 [236] -0.0149786469  0.0409593592  0.0637566081  0.0986445415  0.0033977556
 [241] -0.0302023558  0.0911537350  0.0191649555  0.0758901198 -0.0321716293
 [246] -0.0510104831  0.0224476969 -0.0375820310  0.0142128408 -0.0356043522
 [251] -0.0341683778 -0.0539728132  0.0018787251 -0.0966453136  0.0090996169
 [256] -0.0187915885  0.0026790108 -0.0498575499 -0.0187915885  0.0260504202
 [261] -0.0702179177  0.0942928040 -0.0531294881 -0.0436781609 -0.0265610438
 [266]  0.0703239519 -0.0071239718 -0.0375820310  0.0271644333  0.0037279048
 [271]  0.0438648590  0.0224476969 -0.0674151311  0.0009001153 -0.0788367979
 [276]  0.0482624005 -0.0531294881  0.1403770767 -0.0356043522  0.0373909332
 [281] -0.0246014493  0.0090996169  0.0142128408 -0.0510104831  0.0613074252
 [286] -0.0046082949  0.0878623188  0.0467980296  0.0174825175 -0.0765785938
 [291]  0.0018787251  0.0348153376  0.0409593592 -0.0059322034  0.0292874396
 [296] -0.0009072658 -0.0089749646  0.0276833414  0.0795470497 -0.0510104831
 [301]  0.0715570836 -0.0071239718  0.0394657976  0.0613074252 -0.0603448276
 [306] -0.0131141808 -0.0246014493 -0.0302023558 -0.0071239718  0.0348153376
 [311]  0.0558560192 -0.0356043522 -0.0317304241  0.0108323407 -0.0166634744
 [316]  0.0637566081 -0.0112775240 -0.0656660413  0.0482624005  0.0379442982
 [321]  0.0037279048  0.0226963618 -0.0457642516 -0.0187915885 -0.0669490854
 [326] -0.0263461114  0.0260504202 -0.0408169680 -0.0027433479  0.0379442982
 [331]  0.0437829470  0.0208204399 -0.0625210084  0.0108323407 -0.0076867914
 [336] -0.0489180408 -0.0382440232  0.0409593592  0.0157677185 -0.1109688519
 [341] -0.0227169468 -0.0168710805 -0.0149786469 -0.0265610438  0.0044296788
 [346] -0.0285484057 -0.0112775240 -0.0302023558  0.0026790108 -0.0834244649
 [351]  0.0140252454  0.0363943215 -0.0168710805 -0.0468523724 -0.0046082949
 [356] -0.0467170478 -0.0603448276  0.0276833414 -0.0149786469  0.0108323407
 [361]  0.0332068311  0.0332068311  0.0061524144 -0.0428018076  0.0383336530
 [366]  0.0226963618 -0.0207655142 -0.0027433479 -0.1265233623  0.0157677185
 [371]  0.0090996169  0.0308631787 -0.0652350571 -0.0053012048 -0.0436781609
 [376]  0.0157677185 -0.0448136082  0.0174825175 -0.0989785044 -0.0539728132
 [381]  0.0529610014  0.0276833414 -0.0089749646  0.1396910248  0.0208204399
 [386]  0.0000000000 -0.0131141808  0.0140252454 -0.0630808697  0.0783546864
 [391] -0.0521809270 -0.0285484057 -0.0166634744  0.0026790108 -0.0718513291
 [396] -0.0263461114  0.0256192450 -0.0321716293  0.0044296788  0.0055476529
 [401] -0.0674151311  0.0690649924  0.0422310413  0.0677795031  0.0090996169
 [406] -0.0166634744 -0.0187915885  0.0558560192 -0.0574458683  0.0190767934
 [411]  0.0379442982 -0.0356043522 -0.0970839260  0.0240471513  0.0467980296
 [416] -0.1030789826 -0.0168710805  0.0453050786  0.0524900713 -0.0321716293
 [421]  0.0878623188 -0.0112775240 -0.0478400296 -0.0094684743 -0.0071239718
 [426]  0.0271644333 -0.0428018076  0.0409593592  0.0572601936 -0.0855402456
 [431] -0.0560704356 -0.0718513291  0.0394657976 -0.0321716293  0.0260504202
 [436] -0.0652350571  0.0271644333 -0.0009072658 -0.0168710805 -0.0094684743
 [441] -0.0112775240 -0.0265610438  0.0437829470 -0.0321716293  0.0453050786
 [446]  0.0739485883 -0.0046082949  0.0467980296 -0.0336538462  0.0044296788
 [451] -0.0468523724 -0.0321716293  0.0018787251  0.0511078180 -0.0035064574
 [456] -0.0721366479  0.0224476969 -0.0395869191  0.0224476969  0.0243882326
 [461] -0.0246014493 -0.0035064574  0.0453050786 -0.0084251317 -0.0416189931
 [466]  0.0424255297 -0.0302023558 -0.0457642516 -0.0302023558  0.0308631787
 [471]  0.0394657976 -0.0017394829 -0.0674151311 -0.0089749646  0.0315683056
 [476] -0.0094684743  0.0260504202  0.0108323407  0.0931354698  0.0095154156
 [481]  0.0324110390  0.0044296788 -0.0468523724  0.0073381465 -0.0531294881
 [486] -0.0207655142  0.0174808406  0.0292874396 -0.0346758968 -0.0207402180
 [491]  0.0026790108 -0.0089749646 -0.0552747525 -0.0539728132 -0.0603448276
 [496]  0.0586363766  0.0174808406  0.0599852344  0.0073381465 -0.0382440232
 [501]  0.0026790108 -0.0302023558  0.0122531168  0.0292874396  0.0158613373
 [506]  0.0878623188 -0.0053012048 -0.0089749646  0.0308631787 -0.0017394829
 [511] -0.0207655142  0.0572601936  0.0613074252 -0.0789036545 -0.0017394829
 [516] -0.0603448276 -0.0112775240  0.0125366330  0.0174808406 -0.0168710805
 [521]  0.0363943215  0.0243882326  0.0703239519 -0.0674151311  0.0174808406
 [526]  0.0044296788  0.1211900084  0.0090996169 -0.0065022114 -0.0265610438
 [531] -0.0053012048 -0.0305634582 -0.0489180408 -0.0149786469  0.0061524144
 [536] -0.0131141808  0.0438648590  0.0224476969 -0.0035064574 -0.0053012048
 [541] -0.0302023558 -0.0263461114 -0.0341683778 -0.0017394829 -0.0625210084
 [546] -0.0053012048  0.0727650728 -0.0285484057  0.0727650728  0.0142128408
 [551]  0.0292874396 -0.0053012048  0.0125366330 -0.0382440232 -0.0168710805
 [556]  0.0363943215 -0.0131141808  0.0095154156  0.0664667666  0.0379442982
 [561] -0.0131141808  0.0276833414  0.0538461538 -0.0302023558  0.0108323407
 [566]  0.0409593592 -0.0112775240 -0.0498575499  0.0009001153 -0.0282605410
 [571]  0.0922023182 -0.0108543417 -0.0789036545 -0.0282605410  0.0544231807
 [576] -0.0035064574 -0.0341683778 -0.0207655142  0.0142128408 -0.0989785044
 [581]  0.0586363766  0.0061524144 -0.0468523724 -0.0187915885 -0.0350234168
 [586] -0.0009072658  0.0044296788  0.1065699007 -0.0263461114  0.0931354698
 [591] -0.0375820310  0.0677795031 -0.0468523724  0.0771359700  0.0348153376
 [596]  0.0026790108 -0.0416189931  0.0538461538  0.0208204399 -0.0282605410
 [601] -0.0543710021  0.0260504202  0.0965222532  0.0564821712 -0.0489180408
 [606]  0.0260504202 -0.0336538462 -0.0282605410  0.0308631787 -0.0017394829
 [611]  0.0599852344 -0.0071239718 -0.0436781609 -0.0071239718  0.0466651992
 [616]  0.0157677185  0.0009001153  0.0586363766  0.0243882326  0.0409593592
 [621]  0.0339315128 -0.0527052926 -0.0035064574 -0.0630808697 -0.0187915885
 [626]  0.0026790108  0.0044296788  0.0191649555 -0.0131141808 -0.0035064574
 [631]  0.0942928040  0.0900813854  0.0638743900 -0.0226696259  0.0192220715
 [636]  0.0009001153 -0.0416189931  0.0108323407  0.0191649555  0.1094814039
 [641] -0.0244589433 -0.1054347826  0.0354251012 -0.0677968823  0.0174808406
 [646]  0.0558560192  0.0986445415  0.0348153376 -0.0131141808 -0.0388590327
 [651] -0.0188890000  0.0315683056  0.0208204399  0.0467980296 -0.0609528487
 [656] -0.0227169468  0.0831036016  0.0276833414  0.0677795031 -0.0246014493
 [661]  0.0026790108  0.1104033170  0.0613074252 -0.0131141808  0.1025958512
 [666]  0.0158613373  0.0174808406  0.0073381465 -0.0500160565  0.0260504202
 [671] -0.0510104831 -0.0498575499  0.0623576809 -0.0743450390  0.0142128408
 [676] -0.0084251317  0.0224476969 -0.0053012048  0.0677795031  0.0424255297
 [681]  0.0308631787  0.0524900713 -0.0094684743  0.0626035978  0.0315683056
 [686] -0.0341683778 -0.0246014493 -0.1078131820 -0.1061120543 -0.0131141808
 [691] -0.0017394829 -0.0346758968 -0.0168710805  0.0409593592 -0.0226696259
 [696]  0.0572601936  0.0018787251 -0.0947288006 -0.0519018205  0.0795470497
 [701] -0.0395869191  0.0037279048  0.0090996169  0.0394657976 -0.0146985962
 [706]  0.0260504202  0.0090996169  0.0224476969 -0.0565855160  0.0878623188
 [711]  0.0511078180 -0.0403225806 -0.0226696259 -0.0282605410  0.0174808406
 [716]  0.0308631787  0.0638743900  0.0026790108  0.0339315128  0.1065699007
 [721] -0.0226696259 -0.0468523724 -0.0341683778 -0.0108543417  0.0332068311
 [726]  0.0108323407 -0.0560704356 -0.0457642516  0.0368923112 -0.0510104831
 [731]  0.0572601936 -0.0046082949 -0.0009072658 -0.0168710805 -0.0789036545
 [736] -0.0108543417  0.0276833414  0.0174808406 -0.0588511903 -0.0855402456
 [741] -0.0226696259 -0.0302023558  0.0125366330 -0.0966453136  0.0073381465
 [746]  0.0256192450 -0.0009072658 -0.0395869191  0.0224476969  0.0651260504
 [751] -0.0531294881 -0.0071239718 -0.0265610438 -0.0282605410  0.0466651992
 [756] -0.0071239718  0.0158613373  0.0256192450 -0.0789036545 -0.0207402180
 [761]  0.0078475430  0.0409593592 -0.0416189931 -0.0375820310 -0.0108543417
 [766] -0.0188890000 -0.0588511903  0.0339315128  0.0524900713 -0.0519018205
 [771]  0.0308631787 -0.0065022114 -0.0382440232 -0.0225988701  0.0240471513
 [776]  0.0142128408 -0.0225988701 -0.0468523724 -0.0009072658 -0.0089749646
 [781] -0.0149786469  0.0009001153  0.0424255297  0.0260504202 -0.0246014493
 [786] -0.0395869191  0.0108323407  0.0044296788 -0.0457642516  0.0073381465
 [791]  0.0191649555 -0.0265610438  0.0379442982  0.0900813854 -0.0361925511
 [796]  0.0626035978 -0.0168710805 -0.0428018076 -0.0065022114 -0.0428018076
 [801] -0.0108543417  0.0855386931 -0.0416189931 -0.0630808697  0.0226963618
 [806] -0.0108543417  0.0482624005  0.0332068311  0.0482624005  0.0637566081
 [811] -0.0346758968 -0.0448136082 -0.0428018076 -0.0567760165  0.0276833414
 [816] -0.0321716293  0.0308631787  0.0452778988  0.0061524144 -0.0282605410
 [821]  0.0125366330 -0.0089749646 -0.0089749646 -0.0416189931  0.0224476969
 [826]  0.0482624005  0.0000000000 -0.0603448276 -0.0531294881 -0.0448136082
 [831] -0.0246014493 -0.0009072658  0.0482624005 -0.0017394829 -0.0187915885
 [836] -0.0226696259  0.0142128408  0.0424255297 -0.0603448276  0.0191649555
 [841] -0.0669490854  0.0044296788 -0.0027433479  0.0664667666 -0.0448136082
 [846]  0.0140252454 -0.0035064574  0.0009001153  0.0942928040 -0.0581945229
 [851] -0.0094684743  0.0125366330 -0.0603448276 -0.0943357533  0.0613074252
 [856]  0.0354251012 -0.0510104831  0.0424255297  0.0276833414 -0.0053012048
 [861] -0.0741063644 -0.0811389844 -0.0009072658 -0.0416189931 -0.0531294881
 [866] -0.0226696259  0.0332068311 -0.0053012048  0.0496987952 -0.0009072658
 [871]  0.0090996169  0.0855386931 -0.0035064574 -0.0046082949 -0.0531294881
 [876] -0.0765785938  0.0324110390 -0.0468523724 -0.0321716293 -0.0009072658
 [881]  0.0044296788  0.0363943215 -0.0552747525 -0.0207655142 -0.0457642516
 [886] -0.0009072658  0.0140252454 -0.0226696259  0.0125366330 -0.0168710805
 [891]  0.0224476969 -0.0071239718 -0.0581945229 -0.0207402180 -0.0552747525
 [896] -0.0053012048 -0.0246014493  0.0437829470 -0.0053012048  0.0191649555
 [901] -0.0630808697 -0.0146985962 -0.0630808697 -0.0321716293  0.0090996169
 [906]  0.0073381465  0.1186674431 -0.0674151311 -0.0468523724  0.0379442982
 [911]  0.0037279048  0.0090996169  0.0108323407  0.0572601936 -0.0519018205
 [916]  0.0558560192  0.0496987952  0.0061524144 -0.0226696259 -0.0168710805
 [921]  0.0613074252  0.0409593592 -0.0498575499  0.0122531168 -0.0149786469
 [926] -0.0103770089  0.0174808406 -0.0017394829 -0.0282605410 -0.0089749646
 [931]  0.0009001153 -0.0246014493  0.0125366330 -0.0035064574  0.0125366330
 [936]  0.0551766585  0.0108323407 -0.0531294881 -0.0127622062 -0.0071239718
 [941]  0.0572601936 -0.0416189931 -0.0152180784  0.0544231807  0.0511078180
 [946] -0.0065022114  0.0142128408 -0.0436781609 -0.0833991471  0.0467980296
 [951] -0.0788367979 -0.0341683778 -0.0263461114  0.0324110390 -0.0321716293
 [956]  0.0292874396  0.0572601936 -0.0765785938  0.0090996169 -0.0356043522
 [961] -0.0674151311  0.0379442982  0.0224476969 -0.0285484057  0.0315683056
 [966] -0.0489180408  0.0613074252  0.0260504202 -0.0089749646 -0.0321716293
 [971]  0.0623576809  0.0354251012  0.0308631787 -0.0856836006  0.0140252454
 [976] -0.0341683778  0.0292874396  0.0078475430  0.0000000000  0.0276833414
 [981] -0.0539728132 -0.0900866813 -0.0207655142  0.0061524144  0.1186674431
 [986] -0.0336538462 -0.0647226174  0.0324110390  0.0467980296  0.1075656202
 [991] -0.0788367979  0.0111564042 -0.0149786469 -0.0170399221  0.0975963281
 [996]  0.0292874396  0.0558560192  0.0018787251  0.0379442982  0.0208204399

$pvalue
[1] 0.605

$expectation
[1] 0.3179348

$statistics
[1] -0.02460145

$pvalue
[1] NaN

$expectation
[1] 0.3179348

$accuracy
[1] 1

$error.type
[1] "average"

$statistics
[1] -0.02460145

$pvalue
[1] 0.585273

$expectation
[1] 0.3179348

$statistics
[1] -0.02460145

$pvalue
[1] 0.520712

$expectation
[1] 0.3179348

jaccard documentation built on May 2, 2019, 12:51 p.m.