# D3M: Two Sample Test with Distribution-Valued Data In D3M: Two Sample Test with Wasserstein Metric

## Description

Two Sample Test with Distribution-Valued Data

## Usage

 ```1 2``` ```d3m(cases, control, rm.mean = FALSE, rm.var = FALSE, paranum = 101, q = 2, bsn = 5000, seed = 100) ```

## Arguments

 `cases` name of case group data (matrix) `control` names of control group data (matrix) `rm.mean` standarize each rows of cases and control to mean=0. `rm.var` standarize each rows of cases and control to var=1. `paranum` the number of quatile discretization + 1. Default is discretized by 1 %. `q` power of Wasserstein metric. Default is q = 2. `bsn` the number of resampling. Default is bsn = 5000. `seed` seed for random number generator.

## Details

this function is designed for two sample test based on Wasserstein metric. The function computes the the p-values based Wasserstein metric and resampling method. If rm.mean=F and rm.var=F, then statistical test is performed only based on more than 3rd order moments.

## Value

pval p-value.

test.stat test statistic.

cases case group data used in the statistical test.

control control group data used in the statistical test.

## Author(s)

Yusuke Matsui & Teppei Shimamura

## References

Yusuke Matsui, Masahiro Mizuta, Satoru Miyano and Teppei Shimamura.(2015) D3M:Detection of differential distributions of methylation patterns (submitted). BIORXIV/2015/023879.

Antonio Irpino and Rossanna Verde.(2015) Basic Statistics for distributional symbolic variables: a new metric-based approach. Adv.Data.Anal.Classif(9) 143–175

## Examples

 ```1 2 3 4``` ```nrep <-12 cases <- Map(rbeta,rep(30,nrep),rep(1,nrep),rep(5,nrep)); cases <- do.call("rbind",cases) control <- Map(rbeta,rep(30,nrep),rep(1,nrep),rep(5,nrep)); control <- do.call("rbind",control) d3m(cases,control,paranum = 101, q = 2, bsn = 1000,seed = 100) ```

### Example output

```\$pval
[1] 0.851 0.025 0.196 0.867   NaN 0.785 0.772 0.383 0.932 0.192 0.482 0.477

\$test.stat
[1]  3.069028 34.091086 15.132622  3.688740  8.597571  4.708509  5.747309
[8] 13.505264  1.212303 16.708722 10.806546 15.352007

\$cases
[,1]       [,2]        [,3]       [,4]       [,5]       [,6]
[1,] 0.16494975 0.13000779 0.005839623 0.57911267 0.28731380 0.42307661
[2,] 0.17984683 0.41352822 0.203947878 0.07345705 0.04957692 0.29184715
[3,] 0.22887645 0.07638192 0.341826822 0.05376949 0.13035680 0.21729829
[4,] 0.10350287 0.25892789 0.123271255 0.06098013 0.19405174 0.18482896
[5,] 0.09971235 0.20936106 0.059360676 0.24083778 0.10367499 0.49284042
[6,] 0.27215423 0.19755369 0.351506239 0.14264321 0.36512771 0.13142883
[7,] 0.15727341 0.01768866 0.074988337 0.03879931 0.37890396 0.33251047
[8,] 0.35565529 0.39429584 0.119263395 0.35249260 0.05121300 0.04739250
[9,] 0.25289031 0.11234926 0.164555453 0.07885851 0.17822697 0.27062019
[10,] 0.32174059 0.02452325 0.169261163 0.38091106 0.21657444 0.11567019
[11,] 0.03326824 0.15944652 0.031926257 0.15853844 0.24839555 0.29680502
[12,] 0.20938755 0.14961354 0.211935517 0.04891477 0.12746592 0.08736557
[,7]       [,8]        [,9]      [,10]      [,11]        [,12]
[1,] 0.03781933 0.08778551 0.381703339 0.24941360 0.04050095 0.0527350865
[2,] 0.01463712 0.03069975 0.002631145 0.02603439 0.17580373 0.0006449361
[3,] 0.06514635 0.03530527 0.112423874 0.42148922 0.03186828 0.0520095832
[4,] 0.03173535 0.03198098 0.018166288 0.01647304 0.03449032 0.3164766341
[5,] 0.21162319 0.27999948 0.194553701 0.11648100 0.20394710 0.4125189557
[6,] 0.46189678 0.30562956 0.091912708 0.08528445 0.58197185 0.1292347846
[7,] 0.07790125 0.44856846 0.122171597 0.17154425 0.29315168 0.1767421817
[8,] 0.29673650 0.02137439 0.025236427 0.12274347 0.08560000 0.3254986453
[9,] 0.29959028 0.12904186 0.021501567 0.04351950 0.10391672 0.2788294752
[10,] 0.09712463 0.06804455 0.154601356 0.12889293 0.12552086 0.4584444022
[11,] 0.20581976 0.24380265 0.185390658 0.36883616 0.08463964 0.1445823344
[12,] 0.66167423 0.10050980 0.144235888 0.19302999 0.20769762 0.0801242244
[,13]       [,14]      [,15]       [,16]       [,17]      [,18]
[1,] 0.02996351 0.332999768 0.04915038 0.122074374 0.182290364 0.07703169
[2,] 0.45349606 0.067930713 0.22870414 0.266895143 0.057732789 0.11812499
[3,] 0.15189523 0.169866171 0.19541485 0.090330648 0.118821194 0.40240030
[4,] 0.18116748 0.138466547 0.00959673 0.368228662 0.378393787 0.08726872
[5,] 0.05307644 0.034164594 0.33586142 0.100830947 0.508792272 0.01590300
[6,] 0.31506494 0.299513793 0.29756122 0.004251189 0.040981244 0.17731246
[7,] 0.04412157 0.190616780 0.07107499 0.336510168 0.239959353 0.26814726
[8,] 0.13239524 0.007772587 0.04328260 0.042217490 0.436796447 0.69292349
[9,] 0.15405789 0.396215793 0.13187590 0.074420756 0.006711144 0.12573830
[10,] 0.03496947 0.091959016 0.17334755 0.037766595 0.189768405 0.11748691
[11,] 0.33505022 0.002385293 0.30997879 0.350309415 0.230660908 0.10300433
[12,] 0.09715746 0.056294755 0.17575488 0.294009011 0.515612686 0.01996566
[,19]       [,20]      [,21]       [,22]       [,23]      [,24]
[1,] 0.192018280 0.141837892 0.08343329 0.399651161 0.076005162 0.04741625
[2,] 0.393756558 0.108044529 0.04026233 0.196064561 0.115592898 0.19014270
[3,] 0.369743698 0.525072334 0.13200115 0.005146235 0.144932382 0.13196615
[4,] 0.145586879 0.310376902 0.26977759 0.284239978 0.128344665 0.15752947
[5,] 0.110940556 0.158832567 0.11967419 0.290018872 0.026066642 0.18307625
[6,] 0.083476231 0.153788712 0.09430753 0.266493781 0.240540806 0.03303692
[7,] 0.005304454 0.002042212 0.07206762 0.040073872 0.650452077 0.06440946
[8,] 0.172041670 0.214947539 0.09568253 0.130423307 0.224466220 0.01738294
[9,] 0.086073477 0.130399145 0.19281189 0.021410384 0.250835815 0.11523966
[10,] 0.595202653 0.229863559 0.01102579 0.251643297 0.002350869 0.35805821
[11,] 0.068974859 0.186569509 0.12241215 0.035704740 0.245550880 0.54001020
[12,] 0.017083913 0.143582406 0.38154230 0.170865575 0.244857988 0.01911839
[,25]      [,26]      [,27]        [,28]       [,29]      [,30]
[1,] 0.06918756 0.08736086 0.02507107 3.981228e-01 0.341553546 0.23148000
[2,] 0.23718980 0.03576096 0.47681237 1.303084e-01 0.119274815 0.42060506
[3,] 0.28213074 0.53236133 0.04221464 2.904988e-01 0.256482036 0.10579909
[4,] 0.56497202 0.27148402 0.13305216 7.871495e-02 0.081235796 0.33415385
[5,] 0.07884287 0.34010548 0.58763884 3.619345e-05 0.167370560 0.00245675
[6,] 0.56712708 0.17015874 0.09989618 1.197926e-01 0.131224232 0.08829853
[7,] 0.28583837 0.28157169 0.06926968 2.743188e-01 0.193737966 0.02016066
[8,] 0.03670545 0.45653258 0.20111300 1.834777e-01 0.205691170 0.08255591
[9,] 0.08411888 0.05813652 0.27874579 2.394041e-02 0.217708846 0.15669990
[10,] 0.27022714 0.12154312 0.10399874 3.843901e-01 0.105488719 0.11755238
[11,] 0.06060389 0.08469936 0.05990795 3.216829e-01 0.004655747 0.21588177
[12,] 0.15026325 0.31240429 0.05717624 2.288100e-01 0.320796548 0.20301098

\$control
[,1]        [,2]        [,3]       [,4]       [,5]       [,6]
[1,] 0.0879394496 0.132224428 0.599306503 0.19949891 0.15744042 0.25715768
[2,] 0.0005948077 0.056282936 0.020162594 0.14688577 0.23030239 0.35337690
[3,] 0.0732050967 0.037594025 0.090281394 0.01369348 0.03501452 0.02029322
[4,] 0.0786680269 0.296118611 0.158339696 0.50745152 0.20718207 0.18573891
[5,] 0.2882649528 0.001810702 0.163674598 0.21976622 0.38297809 0.10357426
[6,] 0.0782334077 0.105484587 0.015182036 0.18806975 0.12248614 0.01148674
[7,] 0.0623727259 0.262432661 0.018136571 0.24685841 0.26859022 0.32179007
[8,] 0.1930192740 0.213731371 0.007322504 0.03311947 0.12850696 0.04242528
[9,] 0.1438622770 0.179715025 0.308612429 0.04999903 0.02184735 0.26525113
[10,] 0.0253674267 0.022665914 0.031201268 0.27444232 0.06907625 0.14685531
[11,] 0.0296152582 0.329980259 0.041278556 0.04957467 0.11516288 0.12081863
[12,] 0.0632060679 0.475486787 0.108006537 0.28555276 0.10641654 0.11734544
[,7]        [,8]        [,9]       [,10]      [,11]      [,12]
[1,] 0.02917643 0.182836477 0.024034244 0.103650991 0.12062353 0.41553115
[2,] 0.16968623 0.092195065 0.303343404 0.316082575 0.14329990 0.27736573
[3,] 0.16931662 0.143058143 0.008365149 0.107114429 0.02456208 0.19373118
[4,] 0.07206166 0.372759430 0.076986722 0.198129831 0.54572699 0.68889086
[5,] 0.02041823 0.036657659 0.213669354 0.142977217 0.64395136 0.19382810
[6,] 0.08761590 0.090580488 0.145110293 0.044291438 0.13523382 0.19368272
[7,] 0.03160784 0.072638116 0.151167247 0.024467020 0.18031570 0.03903705
[8,] 0.01122167 0.102929898 0.512902885 0.031342985 0.63765742 0.22011145
[9,] 0.01851223 0.003705250 0.069130799 0.116702415 0.02317527 0.06046463
[10,] 0.14935403 0.548904278 0.011357553 0.007084553 0.22472627 0.33628991
[11,] 0.01049899 0.008554756 0.248059503 0.072133405 0.08724778 0.13889342
[12,] 0.22751968 0.061137964 0.019178154 0.026172785 0.16101651 0.64196190
[,13]       [,14]        [,15]       [,16]       [,17]       [,18]
[1,] 0.04838969 0.190068347 0.0180101107 0.348870264 0.111475669 0.075077740
[2,] 0.26298487 0.049384384 0.2371261736 0.113325145 0.232042691 0.033257939
[3,] 0.44743167 0.056258482 0.1779861392 0.119163095 0.266074935 0.460386124
[4,] 0.03524156 0.309748225 0.4769386904 0.345008261 0.294709618 0.124427283
[5,] 0.32970136 0.030874838 0.1803203748 0.231645705 0.251304140 0.007291281
[6,] 0.28531321 0.284824142 0.0304047632 0.005498898 0.168745423 0.044249438
[7,] 0.11783220 0.540370696 0.3032288178 0.072241928 0.009699199 0.156978661
[8,] 0.06155307 0.007998244 0.1237156136 0.039919555 0.458957406 0.206719056
[9,] 0.16121726 0.174133397 0.0718347691 0.175832360 0.079445446 0.259138727
[10,] 0.08930335 0.226726858 0.5501650984 0.194959801 0.108047572 0.076480634
[11,] 0.18095298 0.079946198 0.0009754842 0.249769921 0.177259037 0.067203745
[12,] 0.63084388 0.030127080 0.3530328522 0.267420063 0.126517940 0.322084154
[,19]      [,20]       [,21]      [,22]       [,23]      [,24]
[1,] 0.098405273 0.10265983 0.327397104 0.12533519 0.262332771 0.05907844
[2,] 0.096131403 0.08516350 0.171980124 0.33688516 0.005357052 0.04688090
[3,] 0.118796320 0.44094895 0.244551329 0.12377815 0.123909948 0.06153136
[4,] 0.004281222 0.11235817 0.072689698 0.31683102 0.215200165 0.05499708
[5,] 0.588942204 0.09056358 0.343867951 0.12146025 0.466821192 0.44567057
[6,] 0.385255641 0.42380987 0.146587662 0.12407100 0.076839821 0.04981403
[7,] 0.435074385 0.32018694 0.026092187 0.03407617 0.085255515 0.07518916
[8,] 0.005468799 0.09048585 0.381020280 0.12423221 0.038841119 0.14987418
[9,] 0.044209176 0.02431035 0.049140164 0.03574285 0.235776151 0.23513445
[10,] 0.184344794 0.09528412 0.003716665 0.04185162 0.186005569 0.23616179
[11,] 0.641551673 0.22461869 0.179655691 0.14768610 0.315098998 0.02583974
[12,] 0.136411338 0.02216696 0.046812049 0.01337053 0.323893791 0.13967309
[,25]       [,26]      [,27]      [,28]     [,29]       [,30]
[1,] 0.051892987 0.255946878 0.08511455 0.13902665 0.1027749 0.225555198
[2,] 0.648694775 0.240301772 0.25173163 0.22236535 0.1905275 0.145221204
[3,] 0.053539080 0.125538147 0.65694254 0.21491982 0.5104827 0.286427483
[4,] 0.230522001 0.231709044 0.41737126 0.21873651 0.3435802 0.139333998
[5,] 0.232611344 0.032916385 0.04120212 0.43233179 0.2997908 0.072541506
[6,] 0.196003693 0.055849852 0.09816551 0.27774092 0.0124174 0.087501284
[7,] 0.235380132 0.263627421 0.09283875 0.14859788 0.1378751 0.087650668
[8,] 0.431870673 0.058074567 0.03855751 0.11341294 0.4159593 0.155991778
[9,] 0.202297004 0.055243465 0.29158061 0.05486482 0.0446949 0.443541245
[10,] 0.001413295 0.299876268 0.10716257 0.29036300 0.2199682 0.173020105
[11,] 0.033720449 0.014243328 0.04970537 0.07184470 0.1029150 0.005549654
[12,] 0.289011647 0.005422528 0.47344556 0.03986151 0.2244152 0.242930176
```

D3M documentation built on May 30, 2017, 7:19 a.m.