mi4p: multiple imputation for proteomics

This repository contains the R code and package for the mi4p methodology (Multiple Imputation for Proteomics), proposed by Marie Chion, Christine Carapito and Frédéric Bertrand (2021) in Accounting for multiple imputation-induced variability for differential analysis in mass spectrometry-based label-free quantitative proteomics, https://arxiv.org/abs/2108.07086.

The following material is available on the Github repository of the package https://github.com/mariechion/mi4p/.

  1. The Functions folder contains all the functions used for the workflow.

  2. The Simulation-1, Simulation-2 and Simulation-3 folders contain all the R scripts and data used to conduct simulated experiments and evaluate our methodology.

  3. The Arabidopsis_UPS and Yeast_UPS folders contain all the R scripts and data used to challenge our methodology on real proteomics datasets. Raw experimental data were deposited with the ProteomeXchange Consortium via the PRIDE partner repository with the dataset identifiers PXD003841 and PXD027800.

This website and these examples were created by M. Chion, C. Carapito and F. Bertrand.

Installation

You can install the development version of mi4p from github with:

devtools::install_github("mariechion/mi4p")

Examples

First section

library(mi4p)
set.seed(4619)
datasim <- protdatasim()
str(datasim)
#> 'data.frame':    200 obs. of  11 variables:
#>  $ id.obs: int  1 2 3 4 5 6 7 8 9 10 ...
#>  $ X1    : num  99.6 99.9 100.2 99.8 100.4 ...
#>  $ X2    : num  97.4 101.3 100.3 100.2 101.7 ...
#>  $ X3    : num  100.3 100.9 99.1 101.2 100.6 ...
#>  $ X4    : num  99.4 99.2 98.5 99.1 99.5 ...
#>  $ X5    : num  98.5 99.7 100 100.2 100.7 ...
#>  $ X6    : num  200 199 199 200 199 ...
#>  $ X7    : num  200 200 202 199 199 ...
#>  $ X8    : num  202 199 200 199 201 ...
#>  $ X9    : num  200 200 199 201 200 ...
#>  $ X10   : num  200 198 200 201 199 ...
#>  - attr(*, "metadata")='data.frame': 10 obs. of  3 variables:
#>   ..$ Sample.name: chr [1:10] "X1" "X2" "X3" "X4" ...
#>   ..$ Condition  : Factor w/ 2 levels "A","B": 1 1 1 1 1 2 2 2 2 2
#>   ..$ Bio.Rep    : int [1:10] 1 2 3 4 5 6 7 8 9 10
attr(datasim, "metadata")
#>    Sample.name Condition Bio.Rep
#> 1           X1         A       1
#> 2           X2         A       2
#> 3           X3         A       3
#> 4           X4         A       4
#> 5           X5         A       5
#> 6           X6         B       6
#> 7           X7         B       7
#> 8           X8         B       8
#> 9           X9         B       9
#> 10         X10         B      10

AMPUTATION

MV1pct.NA.data <- MVgen(dataset = datasim[,-1], prop_NA = 0.01)
MV1pct.NA.data
#>            X1        X2        X3        X4        X5        X6        X7
#> 1    99.62136  97.36890 100.28075  99.37889  98.48006 200.28026 199.80422
#> 2    99.86342 101.27309 100.86058  99.19046  99.71866 199.26177 200.39344
#> 3   100.21425 100.30241  99.07865  98.51259 100.02675 199.21966 202.28551
#> 4    99.84381 100.20091 101.18119  99.05420 100.18467 200.06153 199.34245
#> 5   100.36412 101.70192 100.59543  99.49536 100.65887 199.25196 199.47146
#> 6   100.70214        NA 101.65048  99.11372 100.94608 201.74710 198.70242
#> 7    99.65595  99.31420 100.02326 101.56787 100.01322 199.91695 199.59548
#> 8    97.98251  97.59303 100.60547  97.81128 101.07808 199.94233 199.46429
#> 9    99.56975 100.09034  99.30467  99.69204 100.78160 200.79724 199.30691
#> 10   99.66258  99.27055  98.28584  99.76234 100.15253 199.05707 200.98124
#> 11  100.67448  98.76728  99.03524 100.05411  99.65590  99.17835  98.58828
#> 12   99.70519 101.44341 100.27238 100.05246 100.22091 100.72780  99.40128
#> 13  100.22737  98.20463 100.17269  99.25860  97.97791 100.25975 100.44203
#> 14   99.58471  99.56201 100.68163 100.80704 101.25322 100.22989 101.69888
#> 15   98.88906 100.91857 100.40506  98.21385  99.92004 101.20937 101.01489
#> 16   99.72203 100.13020 100.38206 100.30495 100.50996  99.77492 101.92973
#> 17   98.66712  99.87493  98.73070 100.21022 100.16050  98.70055  99.66331
#> 18  101.74826  99.50606  99.06766 100.88594 100.89332  98.20664  99.92798
#> 19  100.37070  99.92320 101.00412  98.77845  99.51780 100.51887 100.65552
#> 20   99.67479  99.88322  99.71573  98.72810 100.61274  97.97179        NA
#> 21  101.22486 101.49935 100.51086 100.64889 101.37527 100.31040  99.45380
#> 22  100.94777 100.74609  98.16971 100.51673 100.34439 100.46798 101.21767
#> 23   99.23466  98.98854  97.70679  99.66054  99.63939 100.49429  99.84157
#> 24  100.73409 100.11633  99.34654  99.01384 101.20664  99.83183 100.18725
#> 25   99.42769 101.44334 100.31472  99.85531 100.97558  98.07407  99.12720
#> 26   97.98284  98.58111 100.72714 100.77219  99.50288 101.16027  97.92605
#> 27  100.77200  99.87912 100.64746 100.26483  99.76495 101.61521 100.04600
#> 28  101.21120 101.21477  98.66129 100.28078  99.24424  99.46075 101.14263
#> 29   99.89863 100.70173  99.77229  98.53766 100.04275  99.75579 101.32759
#> 30  100.06061 100.37637  99.99705 100.47969  99.08339  99.36436  99.03801
#> 31   98.30618  98.66601  99.96445 100.75600 101.78651  99.57463  97.63290
#> 32   99.20158  99.72202 100.56677 101.86184  98.29285 100.69424  99.51856
#> 33  102.69643  99.43994  99.81578 100.45453 100.66046 101.42928 100.05872
#> 34   99.64883  99.69805 100.82740 100.94480 101.13936 100.43190  98.86824
#> 35  100.52176 100.35496 101.18851 100.98460  99.39586 100.72377 100.78591
#> 36   99.14024 100.18434 101.25128  99.24923  99.25243 101.26967  99.00934
#> 37   98.71673 100.27563 101.26047 100.17444 100.22413  99.39826 101.40395
#> 38   99.60300  99.96101  97.69730 100.69089 100.56642 100.59508 100.64289
#> 39  100.95813  99.81860 101.42839 101.09042  99.95280 100.05541 100.25045
#> 40  100.94308 101.05768 101.33514  98.67754 100.78029 101.33639  99.06949
#> 41  100.08233  99.25436 100.18024  99.49072 101.11272  99.46501  99.42307
#> 42   98.08118  98.05493 101.38092  98.98588 100.38570 101.43547  98.73351
#> 43  100.73244 101.01459  99.31688 100.70114  99.63081 100.12055  98.27283
#> 44  101.37057 100.74243 100.25070 100.36574 100.12416  99.61283  99.72949
#> 45  100.57588  98.59631  99.63513  99.14692 100.54662 100.38188  99.85310
#> 46  102.32726 100.72725 100.83068 100.69548  99.14269  99.33752 100.98748
#> 47  100.66396 101.24997 102.74212 100.21230 100.15852 100.11243  98.59912
#> 48  101.18708  99.14272 100.97788 100.43447 100.20844  98.35361  98.66029
#> 49  100.29781 100.05292 101.81405  99.51584 100.27605  99.18655  99.93729
#> 50   98.90440  98.88690 100.10132  98.60870  99.54416 100.53822  99.79307
#> 51   99.13211 101.27766 100.35375  99.01066  98.65777  99.59689 101.53856
#> 52   99.68964  98.53949        NA  99.63273  99.82911 100.20886  99.59244
#> 53  100.20759 100.75656 101.83451 100.83636 101.20224 101.46609  99.25368
#> 54  100.81381 100.86708  98.98648  97.94897  99.05776 100.18764 101.23422
#> 55   97.62262 100.96918 100.88207  99.72121 101.16145  98.67508  99.75286
#> 56   99.87966  99.11009 100.62407 101.51961  99.07788  98.87347 100.09431
#> 57  100.81265 101.40022 101.64736 100.72335  98.98892  99.42230 100.87794
#> 58   99.42476 100.95793  98.97635 101.74751  99.12457 100.38954  98.87197
#> 59   98.54276 100.53223 100.52489 100.72203 100.67585  98.81364  98.79910
#> 60  101.65724 100.08529 100.82927  99.95037  98.87261  99.72656  99.90579
#> 61  100.22370  99.10401 101.10075 100.55131  98.18042  98.01345        NA
#> 62  100.01483  98.93389 101.42779  99.12747 100.93053 100.67624  98.69724
#> 63   98.03262  98.51941 100.64758  98.84928 100.03873 100.56751  99.63268
#> 64  102.48775 100.54013 100.22541 101.07624 100.45880 100.28039  98.74043
#> 65  101.08856  99.96487  99.35269 100.88600  99.88268  99.03970 100.72421
#> 66   99.28101 100.31202  99.58869  98.36661  98.88559 100.42823 100.11403
#> 67   99.94741  99.59370 101.31019 102.00179  99.71711 100.71517  99.53402
#> 68   99.11708  99.87691 100.41860 100.05917  98.87877 100.05524 100.47340
#> 69   99.83367  99.48486 100.47715 100.42913  99.81200  99.04303  99.16834
#> 70  100.26151  98.90834  99.27541 101.30210 100.63369  98.32762  99.53554
#> 71  101.42782        NA  99.47898  99.69239 101.13070 101.38540  97.77069
#> 72   98.37754  97.58114  98.54586  99.71640  99.18235 102.10023 101.28421
#> 73   98.43999 102.07782  99.31780  97.19951 100.03653  98.74474  98.03535
#> 74   99.21218  99.76310 100.58792 100.51794  98.67775 100.30000 100.60982
#> 75  100.31827 100.87590 100.00028  99.41642  99.73776 100.05191 100.53130
#> 76  101.33601  99.30129 101.45846 100.57889  99.82176  99.35001 101.78012
#> 77   98.71098  98.45163 100.50164  99.49692 100.56487  97.99646 101.16713
#> 78  100.54735 100.13119  99.49891 101.94890 100.94310  99.79346 102.36457
#> 79  100.62054  99.90850  99.83848 101.83898  99.71147  98.91599 100.72897
#> 80  100.87418  99.07000  99.39502  99.07229  99.84750  98.21041  98.99321
#> 81  100.58658 100.55023  98.79955 101.56748  99.77204 101.46388  99.25508
#> 82  100.65936  99.83262 100.37488 100.96218  98.40581 101.40310 100.64276
#> 83  101.05624  99.81584  97.94433 100.75954  99.44069 100.06661  99.26098
#> 84   99.76635  99.48239 100.50835  97.81779  99.47231  99.00190 101.11238
#> 85   99.61604  99.94210  99.92007 100.83718 100.31995 100.67056 101.00432
#> 86  102.65635  98.83253 100.94177 100.24468 100.60003 101.03815  99.16664
#> 87   99.16549  98.59323  98.50025 101.09024  98.26549  99.63777  99.77638
#> 88   99.80314 102.83451  98.62313 100.24650  99.66112 100.47485  99.82777
#> 89  100.81485 100.59225  99.68692 101.42699 100.49860 100.32587 100.42828
#> 90  101.15941  99.94095  99.38685  99.12203  99.97329 100.26401 101.33879
#> 91   99.60963  99.75646  99.79006 101.97879  99.59668  98.13397 100.54690
#> 92   98.67055 101.07326  99.37645 101.50588  99.35769  99.36484 101.20923
#> 93   97.18646 100.47113 101.30328 100.19676 100.38262 100.46563  98.08284
#> 94   99.76743 100.12888 100.75160 100.49422 100.80529 100.52150  98.69169
#> 95   98.92139 100.45915  99.08668 101.39591  99.88206 100.57992  99.18996
#> 96  100.14744  99.68685 101.91843  99.53541  99.69815 100.77521  99.18343
#> 97   97.81162  99.63666 100.95298  98.41874  99.46149 101.44124  99.59299
#> 98   99.35723 100.81867  99.36142  99.72925 100.37592  99.54315 100.70182
#> 99  100.44599 101.11855 101.18338 100.11626  98.76637 100.35712  99.79178
#> 100  99.86970  99.79042  99.41267 101.35380 101.48962  98.37529 100.23905
#> 101 101.47431  98.43315  98.51382 100.92065  99.08222 100.16968 100.03368
#> 102 100.03502 100.79062  99.72300  98.84368  99.46481  99.38080 101.09258
#> 103  99.57257  99.97542 100.48245  99.05654  98.94758  99.15383 100.98345
#> 104  98.23869  99.38987  99.10773  99.32141  99.01698  99.83851 100.56555
#> 105 100.05229 100.33658 100.57941  99.92014 100.75167  99.85726  99.12292
#> 106 100.06020 100.36436 101.04839  99.90625  99.06856  99.40304  99.77989
#> 107 100.78697 100.29635 101.34351  98.79847  98.73562 100.37157  99.33851
#> 108  99.04853 101.54802 102.39035  98.74997 100.80311  99.36435 101.00431
#> 109 100.29807  99.91914 100.09647  99.61130  99.68454  99.54542  99.94014
#> 110 100.00996  99.57172  97.71210  98.48492  99.79371  99.03203  99.78460
#> 111 100.42864  99.08919 101.04291  99.00140  98.92389 100.67435 101.32056
#> 112 100.26558  99.69572 102.66571 100.76607 101.27767 100.90411 102.61595
#> 113 100.13789  98.74178 100.02560 100.47585  98.62588 101.19421 100.25107
#> 114  99.20728  99.17320  99.09790 101.46185 100.41534 101.10293 100.96342
#> 115 102.16407 100.02702 100.98123  99.72735  99.48421 100.21467 101.80124
#> 116  99.72329  99.93928  99.68441 101.41197  99.52737 100.77203  99.71528
#> 117 100.32326 102.47447  98.66896  99.85477 100.00976 100.20038 100.19813
#> 118 100.71835 100.37242 101.12338  99.37908  98.55517  99.93682  99.04064
#> 119  99.58769  99.83928 100.90672  99.55379 100.33225  99.24659  98.74261
#> 120 101.45721  98.80147 100.71581 101.50671 100.23384  99.59456  99.37526
#> 121  97.74395  98.03988  97.59257  99.25657  99.14644  99.03216  99.87320
#> 122  99.53648  99.95157  98.97218  97.76637  99.57592 100.24890  99.46475
#> 123  99.59819 101.59246  99.84393 101.65932  98.67497 101.03136 100.53044
#> 124 100.55792  99.31220 100.49243  99.80183 101.25306 101.17637  99.89330
#> 125  99.54014  98.68227  99.50734 100.30816  99.14884  99.28004 100.82403
#> 126  99.67561 100.97418 100.78798  98.25363 100.47608  99.84862  98.79691
#> 127 101.78977 100.74442 102.11208 101.48878  98.63244  99.77325  98.82267
#> 128  99.93485 100.70836  98.93639 100.83899 101.02054  98.52611  99.52462
#> 129  99.66867 100.24496  99.86456  99.09709  98.94273 100.65458  98.56188
#> 130  98.91078  99.79138 100.28155 102.02624 100.04082 100.44048  99.71897
#> 131 100.52715  99.08120  97.97039 100.70692 100.17289  98.38776 101.07585
#> 132 101.32403  97.79270 100.18696        NA        NA 100.85701 100.32032
#> 133 102.73243  99.14881 100.88526  97.86413 101.42462 100.23550  99.71745
#> 134  96.91355 100.95539  99.80457 100.63926  99.47184 100.90574 100.13840
#> 135 100.00646 100.01781 100.60791 100.08330 100.38260 101.22518  99.42475
#> 136  99.47235  99.00126  99.77235 101.73736 101.46747  98.92124  99.02748
#> 137  99.69947 101.12740  99.20232 100.19946 100.57561 100.12938  99.17633
#> 138  98.65681  99.41049  99.01536  99.56454  99.91585 101.28376 100.77232
#> 139 101.49248  99.51984  99.81268  98.11798  99.92312 101.75853 100.58909
#> 140 100.02625  99.50784 100.16699 100.13994  99.33484 100.17664 100.35799
#> 141        NA 100.82316  99.33397 100.77537  98.98519  98.55963 101.91384
#> 142 100.36174 101.00079        NA 100.67655 100.23349  99.95319 101.61752
#> 143 101.02046 100.13497 101.07472 100.04054  99.39096  99.56348 100.12796
#> 144 101.66051 100.39221  98.97878 101.13356  99.36175  99.96530 100.34920
#> 145 100.95357  98.98128  99.42823 100.34336  99.55851 101.22819  99.43016
#> 146 101.31600 101.20522  99.07790 100.27579  99.49379 101.12240 101.69111
#> 147 101.19975 101.76567  99.77352  98.29425  98.95770 100.51235 102.12028
#> 148 101.72902 101.13997 101.18694  99.88247 100.61675  99.63506 100.45349
#> 149 101.25394  98.87752 100.12827  99.92861  99.68186 102.10665  99.66894
#> 150  99.35037 100.63539 100.86106 101.01252 102.27363 101.54647 101.36150
#> 151  99.12336  98.67527  99.94660 101.51165 100.18394 100.57840 101.14721
#> 152  99.81429 100.80337  98.63386  99.44536 100.15926  98.99341  98.56855
#> 153 100.84963 100.69379 100.27339  99.39224 101.81707  99.64270  98.38824
#> 154  99.38203  99.34741  98.29750  99.63610 100.55278  99.07040  99.94325
#> 155 100.55099 100.34644  99.65762 100.95519 101.10852  99.93297 100.29483
#> 156  99.97815 100.47497  97.94564 100.04144 100.85421 100.07721  98.85379
#> 157  99.54059 101.12604 100.15236 100.63118 102.00903  98.67124 100.60105
#> 158  98.10429 100.52284 100.39234  98.93840 100.18350 100.13128  99.66122
#> 159 101.56135  99.93320 101.14554 100.26996  99.88758  98.96583 100.09356
#> 160 102.23120 100.06674  98.85129  99.91403  99.58684 100.40701  99.99273
#> 161  98.57279  99.63095 100.21493  99.04134 102.41089 100.38154  98.43762
#> 162  99.17784  99.89608 102.48917  99.83903  99.41488  98.81871  99.74507
#> 163  99.96900  99.79411  98.75010 100.05600 101.19766 100.45228        NA
#> 164  99.35957 101.32700  99.03833 101.23702 100.55556 101.54561  98.78897
#> 165 100.50057  98.47721  98.78752 101.50442 100.43447 100.57654 100.48637
#> 166 101.89837  99.97554  99.26773 101.50717  99.32377  99.09005  99.04513
#> 167  99.35180 101.79105  99.64702  99.89800 101.04325 100.74671 100.36547
#> 168 100.53688  98.92227 101.00901 100.96131  99.99951 100.16389 100.26319
#> 169  99.71419 101.07805  98.07288  99.01365  99.95446  99.92435  98.91927
#> 170  99.53651 100.33546  98.89399  99.00587  99.81884 100.54144  98.97271
#> 171 101.56058  98.99244  98.92080  99.73099 101.16093  99.37887  99.94267
#> 172 100.65938  97.89204 100.79800  98.84261  99.75230 100.40575 102.04211
#> 173 100.25037  99.02550 100.82723 100.15753 100.73882  99.77619  98.70182
#> 174 101.12980 101.98038  99.45999 100.99595 100.32239 100.67340 100.16645
#> 175  99.11433 100.77852  99.53179  99.85204 100.56970  99.88505 100.18686
#> 176  99.15214 100.86095  98.34471 100.74780 100.49989  99.99910 101.38773
#> 177  99.41886  99.64155  98.32468  99.04626  97.24285 100.92949        NA
#> 178 100.11651  97.17275  99.96845 101.54229  99.83505 100.06153  97.62115
#> 179  99.63689        NA  99.75536 100.17754 100.46988 101.10038  98.43990
#> 180  99.84637 100.40601 100.05916 101.11842  99.58872  99.85520  99.91521
#> 181 101.02486 100.56533  98.22518 102.09825 100.32895 100.73310 100.68165
#> 182 100.42347 100.19166 101.60415  99.87739        NA  98.88273 100.06559
#> 183  98.94076 100.19819  98.44077  98.92661  99.74783  99.96964  99.73626
#> 184  99.13814  99.31517 100.13815 100.13031 100.55350  98.54476  99.47979
#> 185  99.30269 100.63327 100.20966 100.68484 100.11970  98.86053  99.71518
#> 186  98.45079  99.59803 100.12693  99.24502 100.40249  99.68512 100.09042
#> 187  99.42206 100.51410 101.06231  99.48820  99.98385  99.90819  99.85013
#> 188 100.63477  99.33093  99.61850 100.99894 101.63869  99.05147  99.74901
#> 189        NA  99.45929 101.51794 101.96529 101.05586  99.89515  97.93553
#> 190  98.97009  99.69542  97.80636 101.14444  98.29563 101.98095 100.07633
#> 191  98.95446 100.41046 101.09266 100.41520        NA  99.98042  98.78365
#> 192  99.04542  99.80184  98.21091  98.60624  99.99515  98.77437  98.66983
#> 193  99.41637  97.97899  99.90412 100.36064 100.73206 101.44844  99.50817
#> 194 101.37685 101.64548  99.27031 100.66480  99.85201 102.89578 100.55931
#> 195 100.82945  99.91609 102.08004 101.17104 101.89766  99.80261  98.70985
#> 196 101.14838  99.30620 100.35242 101.49045  99.30625 101.75551 100.15822
#> 197  99.18477 101.23204  99.68272  98.53520 100.85844  99.76638  99.82926
#> 198 100.30693  99.90599 100.34062 100.27440 100.47983  99.80768  99.97969
#> 199  99.16176 100.09225  98.47229  98.60436 100.57002  99.09112  99.82136
#> 200 100.55205  99.09757 100.02664 100.93515  99.96187  99.94529 100.75802
#>            X8        X9       X10
#> 1   201.60954 199.74508 199.75432
#> 2   199.48269 199.72970 198.39845
#> 3   199.71608 198.88835 200.40936
#> 4   199.18647 200.95961 201.27893
#> 5   200.96823 199.98379 198.73031
#> 6   201.80299 199.40298 199.90329
#> 7   201.39032 200.26089 201.08186
#> 8   199.78429 199.69111 199.70172
#> 9   199.78971 201.88039 199.08733
#> 10  200.12561 201.45554 199.41868
#> 11   99.22494  98.54141 101.83299
#> 12   99.56137 102.23024  99.57105
#> 13   99.57370  99.16147  99.52041
#> 14  101.43233 100.21297 100.80091
#> 15   99.91842 100.53775 100.03770
#> 16  100.30625 100.44396  99.33812
#> 17   99.55839  98.62409 100.24479
#> 18   97.68238  98.89593 100.56774
#> 19  101.80858  99.24056 101.23897
#> 20   99.61030  98.69528 100.35563
#> 21  100.46323 100.27759 100.04180
#> 22   99.35589  98.66862  98.92921
#> 23  101.00604  99.00019 101.20803
#> 24   98.13992 101.70280  98.46646
#> 25   99.53977 101.19468 101.62890
#> 26   99.47466  99.10165  99.97932
#> 27  100.55987  99.16342 101.53302
#> 28  101.04240  99.83072  97.23290
#> 29  101.84453  99.57541  99.84934
#> 30   99.57686  99.59102  99.93157
#> 31   99.90373  99.99344 101.02664
#> 32   99.06693  99.07289 101.44852
#> 33   99.89433  99.72724 100.61599
#> 34   99.96153 100.54200 101.70919
#> 35   99.62805  99.01663 100.32899
#> 36   99.24133  99.41116  99.87241
#> 37  101.84888 100.57555  98.78104
#> 38   99.49468  99.37011  99.50465
#> 39  101.35255 100.22298 100.33084
#> 40  101.42822  99.97315  98.71295
#> 41   99.08463 100.73347 100.14049
#> 42   98.25351  99.17284 101.87870
#> 43   99.99836  98.28623  99.04798
#> 44   99.58595 100.59102 100.78820
#> 45  100.14963  99.37502  99.16579
#> 46   99.37594 100.35493 100.13561
#> 47   97.65577 100.91458 100.99970
#> 48  102.58168 100.31207  99.56147
#> 49  100.35470 101.07800  99.64434
#> 50  102.11009  98.73965 100.96517
#> 51  100.48919  99.52892  99.00256
#> 52   99.42755 100.85116  99.45526
#> 53   99.62083 101.46474  99.94194
#> 54   99.56874 100.23675  99.41421
#> 55  101.30089 100.41263  99.82159
#> 56  102.23957 101.24945  99.21182
#> 57   99.81577  99.51272 101.15604
#> 58   99.89209 100.84835 100.76270
#> 59  100.81882 100.46032 101.25812
#> 60   98.94344  99.89661 101.12487
#> 61  100.70073 100.97489 101.00311
#> 62   99.95896  99.09162 100.28762
#> 63   98.33434 101.74138  99.17981
#> 64   98.55782 100.48805  99.06127
#> 65  100.55019 101.13522  99.01184
#> 66   99.46400  99.54982  98.45192
#> 67  100.01518 100.47384  97.41584
#> 68   98.63438  98.65675 101.44591
#> 69  100.31664  99.89835  99.59414
#> 70  101.22029 101.03583  99.05709
#> 71   99.56227  99.91556 100.34972
#> 72         NA  97.77383 100.94120
#> 73  102.24238  99.67195 100.73581
#> 74  100.15740  99.96954  99.92478
#> 75  100.67662 101.86988  98.25933
#> 76  100.04703 101.89692 100.17572
#> 77   99.18905  99.04889  98.77554
#> 78  101.22784 100.68876  99.42993
#> 79   99.38159  98.90303 102.18627
#> 80  102.33368  98.56857 100.57919
#> 81   98.14549  98.95842  99.50920
#> 82  100.57123 101.04280 100.22187
#> 83   99.98457  99.77443 100.01202
#> 84   99.94912  98.83581 100.49362
#> 85   99.40805  99.39592 100.10986
#> 86   99.64301  98.89459 101.33294
#> 87  101.57385 100.94446 100.69335
#> 88  100.45078 100.22406  99.59000
#> 89  100.69815 100.49905  98.37901
#> 90   99.97464 100.31493  98.57134
#> 91   99.71475 102.65816  99.01875
#> 92  101.66662 101.03311 102.42760
#> 93  101.39629  99.03853  98.16374
#> 94  100.96759  98.70530  99.84676
#> 95  100.04035  99.50948 100.51410
#> 96  101.07734  99.54734  98.55898
#> 97  100.52423 100.40615  99.65020
#> 98  100.95334 101.53602 101.36138
#> 99   99.84165 101.68890  99.68010
#> 100  98.64045 100.19707  98.82971
#> 101 101.14528 101.00260 100.38113
#> 102  99.76889 101.29177  99.52597
#> 103 100.73658  99.62709 102.46658
#> 104 100.04455 100.14519  99.68664
#> 105 100.30224  98.46282 100.51789
#> 106  98.95696  98.74467 102.82583
#> 107  99.81845  99.36918 100.50729
#> 108 101.58270 100.59173  99.15632
#> 109 101.36625  99.19570  99.91541
#> 110 101.07580 101.30060  99.27419
#> 111 100.26612 101.31972  99.73967
#> 112  99.43685  99.52570 100.49313
#> 113  98.69532  99.75761 100.84479
#> 114 100.81348  98.51491  99.67011
#> 115 100.16351 101.59292 100.68091
#> 116  99.99175  99.12651 101.00612
#> 117 100.22145  99.12365 100.29100
#> 118  98.89151 100.16667  99.67205
#> 119 100.12206 100.45445  98.98035
#> 120 100.62011  97.42862 100.27381
#> 121  98.78957  99.71182 100.82950
#> 122  99.47013 101.56326  99.00220
#> 123  98.66302  99.22963 100.77061
#> 124 103.17530  99.78989  98.87051
#> 125 101.54236  99.56128 100.88408
#> 126 100.30529  97.97432  99.65551
#> 127 100.41653  98.69798 100.18790
#> 128  98.60685 100.33753  99.38211
#> 129  97.59041 101.54701 100.74700
#> 130 102.71533  99.42912  99.57083
#> 131 100.15810  99.04184 100.12041
#> 132 100.19779  98.18260  99.34926
#> 133  99.18736 100.44620 101.06834
#> 134 100.57072 100.13519 101.25927
#> 135 101.43178  99.62606  98.75997
#> 136 100.21145 100.48916  99.57878
#> 137        NA 101.48055 100.16232
#> 138  99.26532  99.30583  99.34775
#> 139  98.92737  98.96843 101.67678
#> 140 100.59781  99.42692 100.24561
#> 141 100.59833  99.82121 100.39010
#> 142 100.34893 100.69117  99.64098
#> 143 100.93229  99.49657  98.85890
#> 144 101.38495  99.28113  97.71068
#> 145 101.28570  99.81622 101.27804
#> 146  99.37116  99.12229  99.50630
#> 147 100.91637  99.55796 100.27030
#> 148 100.05607  97.59046 100.13782
#> 149  98.86066 100.65749 100.19728
#> 150 100.64655  99.07906  98.43826
#> 151 101.89796 100.36051  99.75036
#> 152  99.22834  97.64830 102.19064
#> 153  99.13401 100.48403 100.41463
#> 154  99.54134  99.90891 100.07935
#> 155 101.20588 100.58404  98.35741
#> 156  98.65663  99.45701  99.84061
#> 157  99.33580 100.27103 100.20660
#> 158  99.55015  99.33020  99.20612
#> 159 100.84752  99.80871  98.13048
#> 160 101.74037 100.84512 101.23351
#> 161  99.70031 100.28413  99.32809
#> 162 100.48981 102.34927 100.66876
#> 163 100.94110  99.62395 100.16423
#> 164 100.35499  99.52542 101.12829
#> 165  99.97883  98.31042 100.89693
#> 166  99.53479 100.40510  99.23999
#> 167 100.30976  99.14864  98.87544
#> 168  99.19505  99.80158  98.66777
#> 169  99.87024 100.53820  99.94677
#> 170        NA 100.05817 100.88796
#> 171  98.83331 101.80895 100.16189
#> 172  99.62743  99.93840 100.67082
#> 173  99.42471  99.72378  99.77871
#> 174 100.29398  99.12843        NA
#> 175  98.58681  98.58413  98.73721
#> 176  98.70339  98.25356 100.96259
#> 177 100.23262 101.82966  99.29007
#> 178 100.39908 100.11528 100.02232
#> 179  99.10681  98.46119  99.39288
#> 180  99.34605  99.79197 101.48782
#> 181  99.92754  99.98381 101.13845
#> 182  99.57566 100.33337 100.26677
#> 183 100.72862 101.25448  98.62645
#> 184 100.66703  99.08472  99.80862
#> 185  99.34550  99.93820  99.99838
#> 186 100.02289  99.81615  98.43183
#> 187 101.91779 100.66520  99.01931
#> 188  98.86573  99.72140 101.12279
#> 189 102.81177 100.31035 100.19551
#> 190 100.96618  98.92151 101.20318
#> 191 101.68623 101.98610 101.26531
#> 192  99.95213 101.44912 100.18530
#> 193  99.36042  99.94494  99.00201
#> 194  99.79288 100.78682 100.69146
#> 195 101.39750 100.23960 100.41265
#> 196 100.69852 100.72249 100.31948
#> 197  99.56309 101.83804 101.06312
#> 198 100.88881 100.19511  98.57926
#> 199        NA  99.70177 102.37253
#> 200 102.14188  99.64349  99.48271

IMPUTATION

MV1pct.impMLE <- multi.impute(data = MV1pct.NA.data, conditions = attr(datasim,"metadata")$Condition, method = "MLE", parallel = FALSE)

ESTIMATION

print(paste(Sys.time(), "Dataset", 1, "out of", 1))
#> [1] "2021-08-18 23:59:06 Dataset 1 out of 1"
MV1pct.impMLE.VarRubin.Mat <- rubin2.all(data = MV1pct.impMLE, metacond = attr(datasim, "metadata")$Condition) 

PROJECTION

print(paste("Dataset", 1, "out of",1, Sys.time()))
#> [1] "Dataset 1 out of 1 2021-08-18 23:59:42"
MV1pct.impMLE.VarRubin.S2 <- as.numeric(lapply(MV1pct.impMLE.VarRubin.Mat, function(aaa){
    DesMat = DAPAR::make.design(attr(datasim, "metadata"))
    return(max(diag(aaa)%*%t(DesMat)%*%DesMat))
  }))
#> Registered S3 method overwritten by 'quantmod':
#>   method            from
#>   as.zoo.data.frame zoo
#> Warning in fun(libname, pkgname): mzR has been built against a different Rcpp version (1.0.6)
#> than is installed on your system (1.0.7). This might lead to errors
#> when loading mzR. If you encounter such issues, please send a report,
#> including the output of sessionInfo() to the Bioc support forum at 
#> https://support.bioconductor.org/. For details see also
#> https://github.com/sneumann/mzR/wiki/mzR-Rcpp-compiler-linker-issue.

MODERATED T-TEST

MV1pct.impMLE.mi4limma.res <- mi4limma(qData = apply(MV1pct.impMLE,1:2,mean), 
                 sTab = attr(datasim, "metadata"), 
                 VarRubin = sqrt(MV1pct.impMLE.VarRubin.S2))
MV1pct.impMLE.mi4limma.res
#> $logFC
#>      A_vs_B_logFC
#> 1   -1.012127e+02
#> 2   -9.927197e+01
#> 3   -1.004769e+02
#> 4   -1.000728e+02
#> 5   -9.911801e+01
#> 6   -9.982359e+01
#> 7   -1.003342e+02
#> 8   -1.007027e+02
#> 9   -1.002846e+02
#> 10  -1.007809e+02
#> 11   1.642084e-01
#> 12   4.052473e-02
#> 13  -6.232310e-01
#> 14  -4.972736e-01
#> 15  -8.743117e-01
#> 16  -1.487572e-01
#> 17   1.704648e-01
#> 18   1.364113e+00
#> 19  -7.736504e-01
#> 20   5.630360e-01
#> 21   9.424812e-01
#> 22   4.170600e-01
#> 23  -1.264042e+00
#> 24   4.178347e-01
#> 25   4.904022e-01
#> 26  -1.515887e-02
#> 27  -3.178319e-01
#> 28   3.805760e-01
#> 29  -6.799174e-01
#> 30   4.990594e-01
#> 31   2.695631e-01
#> 32  -3.121658e-02
#> 33   2.683149e-01
#> 34   1.491150e-01
#> 35   3.924688e-01
#> 36   5.472297e-02
#> 37  -2.712528e-01
#> 38  -2.177595e-01
#> 39   2.072179e-01
#> 40   4.547053e-01
#> 41   2.547398e-01
#> 42  -5.170840e-01
#> 43   1.133979e+00
#> 44   5.092196e-01
#> 45  -8.491259e-02
#> 46   7.063772e-01
#> 47   1.349054e+00
#> 48   4.962941e-01
#> 49   3.511585e-01
#> 50  -1.220144e+00
#> 51  -3.448379e-01
#> 52  -5.184845e-01
#> 53   6.179962e-01
#> 54  -5.934908e-01
#> 55   7.869669e-02
#> 56  -2.914607e-01
#> 57   5.575441e-01
#> 58  -1.067051e-01
#> 59   1.695508e-01
#> 60   3.595042e-01
#> 61  -2.846456e-01
#> 62   3.445642e-01
#> 63  -6.736214e-01
#> 64   1.532072e+00
#> 65   1.427288e-01
#> 66  -3.148159e-01
#> 67   8.832298e-01
#> 68  -1.830318e-01
#> 69   4.032647e-01
#> 70   2.409381e-01
#> 71   1.233375e+00
#> 72  -2.051791e+00
#> 73  -4.717118e-01
#> 74  -4.405299e-01
#> 75  -2.080830e-01
#> 76  -1.506797e-01
#> 77   3.097923e-01
#> 78  -8.702237e-02
#> 79   3.604256e-01
#> 80  -8.521368e-02
#> 81   7.887639e-01
#> 82  -7.293849e-01
#> 83  -1.639307e-02
#> 84  -4.691277e-01
#> 85   9.325053e-03
#> 86   6.400077e-01
#> 87  -1.402221e+00
#> 88   1.201843e-01
#> 89   5.378503e-01
#> 90  -1.762344e-01
#> 91   1.318162e-01
#> 92  -1.143514e+00
#> 93   4.786437e-01
#> 94   6.429156e-01
#> 95  -1.772527e-02
#> 96   3.687938e-01
#> 97  -1.066664e+00
#> 98  -8.906438e-01
#> 99   5.419909e-02
#> 100  1.126928e+00
#> 101 -8.616428e-01
#> 102 -4.405730e-01
#> 103 -9.865894e-01
#> 104 -1.041152e+00
#> 105  6.753898e-01
#> 106  1.474734e-01
#> 107  1.111835e-01
#> 108  1.681135e-01
#> 109 -7.067925e-02
#> 110 -9.789653e-01
#> 111 -9.668787e-01
#> 112  3.390004e-01
#> 113 -5.472008e-01
#> 114 -3.418560e-01
#> 115 -4.138748e-01
#> 116 -6.507368e-02
#> 117  2.593238e-01
#> 118  4.881388e-01
#> 119  5.347332e-01
#> 120  1.084537e+00
#> 121 -1.291370e+00
#> 122 -7.893439e-01
#> 123  2.287629e-01
#> 124 -2.975810e-01
#> 125 -9.810067e-01
#> 126  7.173674e-01
#> 127  1.373830e+00
#> 128  1.012382e+00
#> 129 -2.565706e-01
#> 130 -1.647907e-01
#> 131 -6.508092e-02
#> 132  5.175271e-01
#> 133  2.800798e-01
#> 134 -1.044942e+00
#> 135  1.260690e-01
#> 136  6.445337e-01
#> 137  1.646906e-01
#> 138 -6.823872e-01
#> 139 -6.108207e-01
#> 140 -3.258216e-01
#> 141 -4.868820e-01
#> 142  5.149480e-02
#> 143  5.364877e-01
#> 144  5.671157e-01
#> 145 -7.546692e-01
#> 146  1.110852e-01
#> 147 -6.772738e-01
#> 148  1.336448e+00
#> 149 -3.241622e-01
#> 150  6.122240e-01
#> 151 -8.587254e-01
#> 152  4.453814e-01
#> 153  9.925005e-01
#> 154 -2.654850e-01
#> 155  4.487299e-01
#> 156  4.818324e-01
#> 157  8.746962e-01
#> 158  5.247776e-02
#> 159  9.903067e-01
#> 160 -7.137321e-01
#> 161  3.478403e-01
#> 162 -2.509245e-01
#> 163 -1.043022e+00
#> 164  3.484151e-02
#> 165 -1.089838e-01
#> 166  9.315078e-01
#> 167  4.570214e-01
#> 168  6.675017e-01
#> 169 -2.731210e-01
#> 170 -5.864457e-01
#> 171  4.800880e-02
#> 172 -9.480365e-01
#> 173  7.188479e-01
#> 174  4.299004e-01
#> 175  7.732633e-01
#> 176  5.982326e-02
#> 177 -1.878878e+00
#> 178  8.313797e-02
#> 179  7.412046e-01
#> 180  1.244863e-01
#> 181 -4.439316e-02
#> 182  4.082467e-01
#> 183 -8.122601e-01
#> 184  3.380700e-01
#> 185  6.184746e-01
#> 186 -4.462906e-02
#> 187 -1.780221e-01
#> 188  7.422867e-01
#> 189  8.504415e-01
#> 190 -1.447240e+00
#> 191 -5.486541e-01
#> 192 -6.742420e-01
#> 193 -1.743576e-01
#> 194 -3.833636e-01
#> 195  1.066416e+00
#> 196 -4.101028e-01
#> 197 -5.133464e-01
#> 198  3.714431e-01
#> 199 -6.904036e-01
#> 200 -2.796176e-01
#> 
#> $P_Value
#>     A_vs_B_pval
#> 1   0.000000000
#> 2   0.000000000
#> 3   0.000000000
#> 4   0.000000000
#> 5   0.000000000
#> 6   0.000000000
#> 7   0.000000000
#> 8   0.000000000
#> 9   0.000000000
#> 10  0.000000000
#> 11  0.796941098
#> 12  0.949367396
#> 13  0.328845493
#> 14  0.435896381
#> 15  0.170804559
#> 16  0.815686143
#> 17  0.789383602
#> 18  0.032678839
#> 19  0.225507500
#> 20  0.377692370
#> 21  0.139852178
#> 22  0.513447430
#> 23  0.047758669
#> 24  0.512665570
#> 25  0.442263162
#> 26  0.981049169
#> 27  0.618473149
#> 28  0.550961487
#> 29  0.286774215
#> 30  0.434250458
#> 31  0.672742627
#> 32  0.960986570
#> 33  0.674170532
#> 34  0.815250906
#> 35  0.538586073
#> 36  0.931665593
#> 37  0.670811526
#> 38  0.732939800
#> 39  0.745408176
#> 40  0.476182828
#> 41  0.689774526
#> 42  0.417839744
#> 43  0.075726038
#> 44  0.424954526
#> 45  0.894149436
#> 46  0.268439313
#> 47  0.034647029
#> 48  0.436800667
#> 49  0.582161204
#> 50  0.056024524
#> 51  0.588971036
#> 52  0.416580176
#> 53  0.332923108
#> 54  0.352443711
#> 55  0.901857291
#> 56  0.647888970
#> 57  0.382361413
#> 58  0.867209930
#> 59  0.790486401
#> 60  0.573226392
#> 61  0.655583701
#> 62  0.589266718
#> 63  0.291258749
#> 64  0.016459648
#> 65  0.823029024
#> 66  0.621807695
#> 67  0.166485512
#> 68  0.774263458
#> 69  0.527474211
#> 70  0.705775614
#> 71  0.053416061
#> 72  0.001327678
#> 73  0.459847684
#> 74  0.490038170
#> 75  0.744382370
#> 76  0.813347884
#> 77  0.627379172
#> 78  0.891535505
#> 79  0.572243878
#> 80  0.893776333
#> 81  0.216578083
#> 82  0.253165324
#> 83  0.979506563
#> 84  0.462309373
#> 85  0.988341624
#> 86  0.315996655
#> 87  0.028121277
#> 88  0.850622027
#> 89  0.399393706
#> 90  0.782431621
#> 91  0.836360270
#> 92  0.073299806
#> 93  0.453280658
#> 94  0.313803559
#> 95  0.977841563
#> 96  0.563358277
#> 97  0.094779581
#> 98  0.162957862
#> 99  0.932318203
#> 100 0.077562329
#> 101 0.177083821
#> 102 0.489995750
#> 103 0.122253377
#> 104 0.102936427
#> 105 0.289994394
#> 106 0.817248618
#> 107 0.861691774
#> 108 0.792221635
#> 109 0.911812677
#> 110 0.125164854
#> 111 0.129891010
#> 112 0.595292753
#> 113 0.391250628
#> 114 0.592196448
#> 115 0.516668791
#> 116 0.918781532
#> 117 0.684490200
#> 118 0.444371933
#> 119 0.402130788
#> 120 0.089380260
#> 121 0.043150430
#> 122 0.216240509
#> 123 0.720000187
#> 124 0.641010594
#> 125 0.124380027
#> 126 0.261066023
#> 127 0.031460293
#> 128 0.112795260
#> 129 0.687662205
#> 130 0.796236910
#> 131 0.918772527
#> 132 0.417441001
#> 133 0.660759379
#> 134 0.101690383
#> 135 0.843400388
#> 136 0.312587589
#> 137 0.796357915
#> 138 0.285027866
#> 139 0.338565258
#> 140 0.609677681
#> 141 0.445545325
#> 142 0.935687696
#> 143 0.400588765
#> 144 0.374246784
#> 145 0.237090770
#> 146 0.861812910
#> 147 0.288651505
#> 148 0.036371683
#> 149 0.611499869
#> 150 0.337457060
#> 151 0.178553900
#> 152 0.485271972
#> 153 0.120032717
#> 154 0.677412026
#> 155 0.481996940
#> 156 0.450277631
#> 157 0.170616625
#> 158 0.934462815
#> 159 0.120853136
#> 160 0.263489240
#> 161 0.585731624
#> 162 0.694184376
#> 163 0.102320308
#> 164 0.956460519
#> 165 0.864401320
#> 166 0.144519990
#> 167 0.473939550
#> 168 0.295662704
#> 169 0.668679110
#> 170 0.358187287
#> 171 0.940032877
#> 172 0.137533834
#> 173 0.260083586
#> 174 0.500568547
#> 175 0.225739623
#> 176 0.925314553
#> 177 0.003280237
#> 178 0.896349025
#> 179 0.245558770
#> 180 0.845341413
#> 181 0.944541547
#> 182 0.522386143
#> 183 0.203206394
#> 184 0.596303267
#> 185 0.332549080
#> 186 0.944247318
#> 187 0.780280965
#> 188 0.244870442
#> 189 0.182777701
#> 190 0.023453268
#> 191 0.389994048
#> 192 0.290814582
#> 193 0.784691114
#> 194 0.548048245
#> 195 0.094856436
#> 196 0.520497055
#> 197 0.421212303
#> 198 0.560559032
#> 199 0.279409182
#> 200 0.661284332
(simplify2array(MV1pct.impMLE.mi4limma.res)$P_Value.A_vs_B_pval)[1:10]
#>  [1] 0 0 0 0 0 0 0 0 0 0

(simplify2array(MV1pct.impMLE.mi4limma.res)$P_Value.A_vs_B_pval)[11:200]<=0.05
#>   [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE  TRUE FALSE FALSE FALSE FALSE
#>  [13]  TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
#>  [25] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
#>  [37]  TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
#>  [49] FALSE FALSE FALSE FALSE FALSE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE
#>  [61] FALSE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
#>  [73] FALSE FALSE FALSE FALSE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
#>  [85] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
#>  [97] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
#> [109] FALSE FALSE  TRUE FALSE FALSE FALSE FALSE FALSE  TRUE FALSE FALSE FALSE
#> [121] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
#> [133] FALSE FALSE FALSE FALSE FALSE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE
#> [145] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
#> [157] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE  TRUE FALSE
#> [169] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE  TRUE
#> [181] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE

True positive rate

sum((simplify2array(MV1pct.impMLE.mi4limma.res)$P_Value.A_vs_B_pval)[1:10]<=0.05)/10
#> [1] 1

False positive rate

sum((simplify2array(MV1pct.impMLE.mi4limma.res)$P_Value.A_vs_B_pval)[11:200]<=0.05)/190
#> [1] 0.05789474
MV1pct.impMLE.dapar.res <-limmaCompleteTest.mod(qData = apply(MV1pct.impMLE,1:2,mean), sTab = attr(datasim, "metadata"))
MV1pct.impMLE.dapar.res
#> $res.l
#> $res.l$logFC
#>      A_vs_B_logFC
#> 1   -1.012127e+02
#> 2   -9.927197e+01
#> 3   -1.004769e+02
#> 4   -1.000728e+02
#> 5   -9.911801e+01
#> 6   -9.982359e+01
#> 7   -1.003342e+02
#> 8   -1.007027e+02
#> 9   -1.002846e+02
#> 10  -1.007809e+02
#> 11   1.642084e-01
#> 12   4.052473e-02
#> 13  -6.232310e-01
#> 14  -4.972736e-01
#> 15  -8.743117e-01
#> 16  -1.487572e-01
#> 17   1.704648e-01
#> 18   1.364113e+00
#> 19  -7.736504e-01
#> 20   5.630360e-01
#> 21   9.424812e-01
#> 22   4.170600e-01
#> 23  -1.264042e+00
#> 24   4.178347e-01
#> 25   4.904022e-01
#> 26  -1.515887e-02
#> 27  -3.178319e-01
#> 28   3.805760e-01
#> 29  -6.799174e-01
#> 30   4.990594e-01
#> 31   2.695631e-01
#> 32  -3.121658e-02
#> 33   2.683149e-01
#> 34   1.491150e-01
#> 35   3.924688e-01
#> 36   5.472297e-02
#> 37  -2.712528e-01
#> 38  -2.177595e-01
#> 39   2.072179e-01
#> 40   4.547053e-01
#> 41   2.547398e-01
#> 42  -5.170840e-01
#> 43   1.133979e+00
#> 44   5.092196e-01
#> 45  -8.491259e-02
#> 46   7.063772e-01
#> 47   1.349054e+00
#> 48   4.962941e-01
#> 49   3.511585e-01
#> 50  -1.220144e+00
#> 51  -3.448379e-01
#> 52  -5.184845e-01
#> 53   6.179962e-01
#> 54  -5.934908e-01
#> 55   7.869669e-02
#> 56  -2.914607e-01
#> 57   5.575441e-01
#> 58  -1.067051e-01
#> 59   1.695508e-01
#> 60   3.595042e-01
#> 61  -2.846456e-01
#> 62   3.445642e-01
#> 63  -6.736214e-01
#> 64   1.532072e+00
#> 65   1.427288e-01
#> 66  -3.148159e-01
#> 67   8.832298e-01
#> 68  -1.830318e-01
#> 69   4.032647e-01
#> 70   2.409381e-01
#> 71   1.233375e+00
#> 72  -2.051791e+00
#> 73  -4.717118e-01
#> 74  -4.405299e-01
#> 75  -2.080830e-01
#> 76  -1.506797e-01
#> 77   3.097923e-01
#> 78  -8.702237e-02
#> 79   3.604256e-01
#> 80  -8.521368e-02
#> 81   7.887639e-01
#> 82  -7.293849e-01
#> 83  -1.639307e-02
#> 84  -4.691277e-01
#> 85   9.325053e-03
#> 86   6.400077e-01
#> 87  -1.402221e+00
#> 88   1.201843e-01
#> 89   5.378503e-01
#> 90  -1.762344e-01
#> 91   1.318162e-01
#> 92  -1.143514e+00
#> 93   4.786437e-01
#> 94   6.429156e-01
#> 95  -1.772527e-02
#> 96   3.687938e-01
#> 97  -1.066664e+00
#> 98  -8.906438e-01
#> 99   5.419909e-02
#> 100  1.126928e+00
#> 101 -8.616428e-01
#> 102 -4.405730e-01
#> 103 -9.865894e-01
#> 104 -1.041152e+00
#> 105  6.753898e-01
#> 106  1.474734e-01
#> 107  1.111835e-01
#> 108  1.681135e-01
#> 109 -7.067925e-02
#> 110 -9.789653e-01
#> 111 -9.668787e-01
#> 112  3.390004e-01
#> 113 -5.472008e-01
#> 114 -3.418560e-01
#> 115 -4.138748e-01
#> 116 -6.507368e-02
#> 117  2.593238e-01
#> 118  4.881388e-01
#> 119  5.347332e-01
#> 120  1.084537e+00
#> 121 -1.291370e+00
#> 122 -7.893439e-01
#> 123  2.287629e-01
#> 124 -2.975810e-01
#> 125 -9.810067e-01
#> 126  7.173674e-01
#> 127  1.373830e+00
#> 128  1.012382e+00
#> 129 -2.565706e-01
#> 130 -1.647907e-01
#> 131 -6.508092e-02
#> 132  5.175271e-01
#> 133  2.800798e-01
#> 134 -1.044942e+00
#> 135  1.260690e-01
#> 136  6.445337e-01
#> 137  1.646906e-01
#> 138 -6.823872e-01
#> 139 -6.108207e-01
#> 140 -3.258216e-01
#> 141 -4.868820e-01
#> 142  5.149480e-02
#> 143  5.364877e-01
#> 144  5.671157e-01
#> 145 -7.546692e-01
#> 146  1.110852e-01
#> 147 -6.772738e-01
#> 148  1.336448e+00
#> 149 -3.241622e-01
#> 150  6.122240e-01
#> 151 -8.587254e-01
#> 152  4.453814e-01
#> 153  9.925005e-01
#> 154 -2.654850e-01
#> 155  4.487299e-01
#> 156  4.818324e-01
#> 157  8.746962e-01
#> 158  5.247776e-02
#> 159  9.903067e-01
#> 160 -7.137321e-01
#> 161  3.478403e-01
#> 162 -2.509245e-01
#> 163 -1.043022e+00
#> 164  3.484151e-02
#> 165 -1.089838e-01
#> 166  9.315078e-01
#> 167  4.570214e-01
#> 168  6.675017e-01
#> 169 -2.731210e-01
#> 170 -5.864457e-01
#> 171  4.800880e-02
#> 172 -9.480365e-01
#> 173  7.188479e-01
#> 174  4.299004e-01
#> 175  7.732633e-01
#> 176  5.982326e-02
#> 177 -1.878878e+00
#> 178  8.313797e-02
#> 179  7.412046e-01
#> 180  1.244863e-01
#> 181 -4.439316e-02
#> 182  4.082467e-01
#> 183 -8.122601e-01
#> 184  3.380700e-01
#> 185  6.184746e-01
#> 186 -4.462906e-02
#> 187 -1.780221e-01
#> 188  7.422867e-01
#> 189  8.504415e-01
#> 190 -1.447240e+00
#> 191 -5.486541e-01
#> 192 -6.742420e-01
#> 193 -1.743576e-01
#> 194 -3.833636e-01
#> 195  1.066416e+00
#> 196 -4.101028e-01
#> 197 -5.133464e-01
#> 198  3.714431e-01
#> 199 -6.904036e-01
#> 200 -2.796176e-01
#> 
#> $res.l$P_Value
#>     A_vs_B_pval
#> 1   0.000000000
#> 2   0.000000000
#> 3   0.000000000
#> 4   0.000000000
#> 5   0.000000000
#> 6   0.000000000
#> 7   0.000000000
#> 8   0.000000000
#> 9   0.000000000
#> 10  0.000000000
#> 11  0.796941098
#> 12  0.949367396
#> 13  0.328845493
#> 14  0.435896381
#> 15  0.170804559
#> 16  0.815686143
#> 17  0.789383602
#> 18  0.032678839
#> 19  0.225507500
#> 20  0.377692370
#> 21  0.139852178
#> 22  0.513447430
#> 23  0.047758669
#> 24  0.512665570
#> 25  0.442263162
#> 26  0.981049169
#> 27  0.618473149
#> 28  0.550961487
#> 29  0.286774215
#> 30  0.434250458
#> 31  0.672742627
#> 32  0.960986570
#> 33  0.674170532
#> 34  0.815250906
#> 35  0.538586073
#> 36  0.931665593
#> 37  0.670811526
#> 38  0.732939800
#> 39  0.745408176
#> 40  0.476182828
#> 41  0.689774526
#> 42  0.417839744
#> 43  0.075726038
#> 44  0.424954526
#> 45  0.894149436
#> 46  0.268439313
#> 47  0.034647029
#> 48  0.436800667
#> 49  0.582161204
#> 50  0.056024524
#> 51  0.588971036
#> 52  0.416580176
#> 53  0.332923108
#> 54  0.352443711
#> 55  0.901857291
#> 56  0.647888970
#> 57  0.382361413
#> 58  0.867209930
#> 59  0.790486401
#> 60  0.573226392
#> 61  0.655583701
#> 62  0.589266718
#> 63  0.291258749
#> 64  0.016459648
#> 65  0.823029024
#> 66  0.621807695
#> 67  0.166485512
#> 68  0.774263458
#> 69  0.527474211
#> 70  0.705775614
#> 71  0.053416061
#> 72  0.001327678
#> 73  0.459847684
#> 74  0.490038170
#> 75  0.744382370
#> 76  0.813347884
#> 77  0.627379172
#> 78  0.891535505
#> 79  0.572243878
#> 80  0.893776333
#> 81  0.216578083
#> 82  0.253165324
#> 83  0.979506563
#> 84  0.462309373
#> 85  0.988341624
#> 86  0.315996655
#> 87  0.028121277
#> 88  0.850622027
#> 89  0.399393706
#> 90  0.782431621
#> 91  0.836360270
#> 92  0.073299806
#> 93  0.453280658
#> 94  0.313803559
#> 95  0.977841563
#> 96  0.563358277
#> 97  0.094779581
#> 98  0.162957862
#> 99  0.932318203
#> 100 0.077562329
#> 101 0.177083821
#> 102 0.489995750
#> 103 0.122253377
#> 104 0.102936427
#> 105 0.289994394
#> 106 0.817248618
#> 107 0.861691774
#> 108 0.792221635
#> 109 0.911812677
#> 110 0.125164854
#> 111 0.129891010
#> 112 0.595292753
#> 113 0.391250628
#> 114 0.592196448
#> 115 0.516668791
#> 116 0.918781532
#> 117 0.684490200
#> 118 0.444371933
#> 119 0.402130788
#> 120 0.089380260
#> 121 0.043150430
#> 122 0.216240509
#> 123 0.720000187
#> 124 0.641010594
#> 125 0.124380027
#> 126 0.261066023
#> 127 0.031460293
#> 128 0.112795260
#> 129 0.687662205
#> 130 0.796236910
#> 131 0.918772527
#> 132 0.417441001
#> 133 0.660759379
#> 134 0.101690383
#> 135 0.843400388
#> 136 0.312587589
#> 137 0.796357915
#> 138 0.285027866
#> 139 0.338565258
#> 140 0.609677681
#> 141 0.445545325
#> 142 0.935687696
#> 143 0.400588765
#> 144 0.374246784
#> 145 0.237090770
#> 146 0.861812910
#> 147 0.288651505
#> 148 0.036371683
#> 149 0.611499869
#> 150 0.337457060
#> 151 0.178553900
#> 152 0.485271972
#> 153 0.120032717
#> 154 0.677412026
#> 155 0.481996940
#> 156 0.450277631
#> 157 0.170616625
#> 158 0.934462815
#> 159 0.120853136
#> 160 0.263489240
#> 161 0.585731624
#> 162 0.694184376
#> 163 0.102320308
#> 164 0.956460519
#> 165 0.864401320
#> 166 0.144519990
#> 167 0.473939550
#> 168 0.295662704
#> 169 0.668679110
#> 170 0.358187287
#> 171 0.940032877
#> 172 0.137533834
#> 173 0.260083586
#> 174 0.500568547
#> 175 0.225739623
#> 176 0.925314553
#> 177 0.003280237
#> 178 0.896349025
#> 179 0.245558770
#> 180 0.845341413
#> 181 0.944541547
#> 182 0.522386143
#> 183 0.203206394
#> 184 0.596303267
#> 185 0.332549080
#> 186 0.944247318
#> 187 0.780280965
#> 188 0.244870442
#> 189 0.182777701
#> 190 0.023453268
#> 191 0.389994048
#> 192 0.290814582
#> 193 0.784691114
#> 194 0.548048245
#> 195 0.094856436
#> 196 0.520497055
#> 197 0.421212303
#> 198 0.560559032
#> 199 0.279409182
#> 200 0.661284332
#> 
#> 
#> $fit.s2
#>   [1] 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841
#>   [9] 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841
#>  [17] 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841
#>  [25] 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841
#>  [33] 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841
#>  [41] 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841
#>  [49] 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841
#>  [57] 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841
#>  [65] 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841
#>  [73] 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841
#>  [81] 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841
#>  [89] 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841
#>  [97] 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841
#> [105] 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841
#> [113] 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841
#> [121] 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841
#> [129] 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841
#> [137] 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841
#> [145] 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841
#> [153] 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841
#> [161] 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841
#> [169] 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841
#> [177] 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841
#> [185] 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841
#> [193] 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841 1.017841

Simulate a list of 100 datasets.

set.seed(4619)
norm.200.m100.sd1.vs.m200.sd1.list <- lapply(1:100, protdatasim)
metadata <- attr(norm.200.m100.sd1.vs.m200.sd1.list[[1]],"metadata")

100 datasets with parallel comuting support. Quite long to run even with parallel computing support.

library(foreach)
doParallel::registerDoParallel(cores=NULL)
requireNamespace("foreach",quietly = TRUE)

AMPUTATION

MV1pct.NA.data <- foreach::foreach(iforeach =  norm.200.m100.sd1.vs.m200.sd1.list,
                          .errorhandling = 'stop', .verbose = T) %dopar% 
  MVgen(dataset = iforeach[,-1], prop_NA = 0.01)

IMPUTATION

MV1pct.impMLE <- foreach::foreach(iforeach =  MV1pct.NA.data,
                         .errorhandling = 'stop', .verbose = F) %dopar% 
  multi.impute(data = iforeach, conditions = metadata$Condition, 
               method = "MLE", parallel  = F)

ESTIMATION

MV1pct.impMLE.VarRubin.Mat <- lapply(1:length(MV1pct.impMLE), function(index){
  print(paste(Sys.time(), "Dataset", index, "out of", length(MV1pct.impMLE)))
  rubin2.all(data = MV1pct.impMLE[[index]], metacond = metadata$Condition) 
})

PROJECTION

MV1pct.impMLE.VarRubin.S2 <- lapply(1:length(MV1pct.impMLE.VarRubin.Mat), function(id.dataset){
  print(paste("Dataset", id.dataset, "out of",length(MV1pct.impMLE.VarRubin.Mat), Sys.time()))
  as.numeric(lapply(MV1pct.impMLE.VarRubin.Mat[[id.dataset]], function(aaa){
    DesMat = DAPAR::make.design(metadata)
    return(max(diag(aaa)%*%t(DesMat)%*%DesMat))
  }))
})

MODERATED T-TEST

MV1pct.impMLE.mi4limma.res <- foreach(iforeach =  1:100,  .errorhandling = 'stop', .verbose = T) %dopar%
  mi4limma(qData = apply(MV1pct.impMLE[[iforeach]],1:2,mean), 
                 sTab = metadata, 
                 VarRubin = sqrt(MV1pct.impMLE.VarRubin.S2[[iforeach]]))

MV1pct.impMLE.dapar.res <- foreach(iforeach =  1:100,  .errorhandling = 'stop', .verbose = T) %dopar%
  limmaCompleteTest.mod(qData = apply(MV1pct.impMLE[[iforeach]],1:2,mean), 
                        sTab = metadata)