>X<-data[["10x10"]]
>w<- runif(nrow(X))
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells3224474172.35709258305.05709258305.0Vcells680901752.022345847170.556666022432.4>colStats<- microbenchmark(colWeightedMeans= colWeightedMeans(X, w=w, na.rm=FALSE), `apply+weigthed.mean`= apply(X,
+MARGIN=2L, FUN=weighted.mean, w=w, na.rm=FALSE), unit="ms")
>X<- t(X)
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells3222908172.25709258305.05709258305.0Vcells680446452.022345847170.556666022432.4>rowStats<- microbenchmark(rowWeightedMeans= rowWeightedMeans(X, w=w, na.rm=FALSE), `apply+weigthed.mean`= apply(X,
+MARGIN=1L, FUN=weighted.mean, w=w, na.rm=FALSE), unit="ms")
Table: Benchmarking of colWeightedMeans() and apply+weigthed.mean() on 10x10 data. The top panel shows times in milliseconds and the bottom panel shows relative times.
expr
min
lq
mean
median
uq
max
1
colWeightedMeans
0.008693
0.009417
0.0106235
0.0101925
0.0113220
0.035141
2
apply+weigthed.mean
0.056830
0.058049
0.0606144
0.0587155
0.0596145
0.225416
expr
min
lq
mean
median
uq
max
1
colWeightedMeans
1.000000
1.000000
1.000000
1.000000
1.000000
1.000000
2
apply+weigthed.mean
6.537444
6.164277
5.705701
5.760657
5.265368
6.414615
Table: Benchmarking of rowWeightedMeans() and apply+weigthed.mean() on 10x10 data (transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
expr
min
lq
mean
median
uq
max
1
rowWeightedMeans
0.010868
0.0119150
0.0133688
0.0134600
0.0139455
0.044320
2
apply+weigthed.mean
0.056178
0.0575745
0.0591443
0.0583855
0.0588660
0.131455
expr
min
lq
mean
median
uq
max
1
rowWeightedMeans
1.00000
1.000000
1.000000
1.000000
1.000000
1.000000
2
apply+weigthed.mean
5.16912
4.832102
4.424048
4.337704
4.221147
2.966042
Figure: Benchmarking of colWeightedMeans() and apply+weigthed.mean() on 10x10 data as well as rowWeightedMeans() and apply+weigthed.mean() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.
Table: Benchmarking of colWeightedMeans() and rowWeightedMeans() on 10x10 data (original and transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
expr
min
lq
mean
median
uq
max
1
colWeightedMeans
8.693
9.417
10.62348
10.1925
11.3220
35.141
2
rowWeightedMeans
10.868
11.915
13.36883
13.4600
13.9455
44.320
expr
min
lq
mean
median
uq
max
1
colWeightedMeans
1.000000
1.000000
1.000000
1.000000
1.000000
1.000000
2
rowWeightedMeans
1.250201
1.265265
1.258423
1.320579
1.231717
1.261205
Figure: Benchmarking of colWeightedMeans() and rowWeightedMeans() on 10x10 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds.
100x100 matrix
>X<-data[["100x100"]]
>w<- runif(nrow(X))
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells3221457172.15709258305.05709258305.0Vcells641929049.022345847170.556666022432.4>colStats<- microbenchmark(colWeightedMeans= colWeightedMeans(X, w=w, na.rm=FALSE), `apply+weigthed.mean`= apply(X,
+MARGIN=2L, FUN=weighted.mean, w=w, na.rm=FALSE), unit="ms")
>X<- t(X)
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells3221451172.15709258305.05709258305.0Vcells642933349.122345847170.556666022432.4>rowStats<- microbenchmark(rowWeightedMeans= rowWeightedMeans(X, w=w, na.rm=FALSE), `apply+weigthed.mean`= apply(X,
+MARGIN=1L, FUN=weighted.mean, w=w, na.rm=FALSE), unit="ms")
Table: Benchmarking of colWeightedMeans() and apply+weigthed.mean() on 100x100 data. The top panel shows times in milliseconds and the bottom panel shows relative times.
expr
min
lq
mean
median
uq
max
1
colWeightedMeans
0.027920
0.0299280
0.0316412
0.0308905
0.0322100
0.059950
2
apply+weigthed.mean
0.607759
0.6153645
0.6292381
0.6225935
0.6315155
0.898593
expr
min
lq
mean
median
uq
max
1
colWeightedMeans
1.00000
1.0000
1.00000
1.00000
1.00000
1.00000
2
apply+weigthed.mean
21.76787
20.5615
19.88664
20.15485
19.60619
14.98904
Table: Benchmarking of rowWeightedMeans() and apply+weigthed.mean() on 100x100 data (transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
expr
min
lq
mean
median
uq
max
1
rowWeightedMeans
0.103243
0.104445
0.1064423
0.1056270
0.1071515
0.139339
2
apply+weigthed.mean
0.564707
0.572189
0.5869633
0.5776505
0.5892865
0.800169
expr
min
lq
mean
median
uq
max
1
rowWeightedMeans
1.000000
1.000000
1.000000
1.000000
1.000000
1.000000
2
apply+weigthed.mean
5.469688
5.478376
5.514382
5.468777
5.499564
5.742606
Figure: Benchmarking of colWeightedMeans() and apply+weigthed.mean() on 100x100 data as well as rowWeightedMeans() and apply+weigthed.mean() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.
Table: Benchmarking of colWeightedMeans() and rowWeightedMeans() on 100x100 data (original and transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
expr
min
lq
mean
median
uq
max
1
colWeightedMeans
27.920
29.928
31.64124
30.8905
32.2100
59.950
2
rowWeightedMeans
103.243
104.445
106.44226
105.6270
107.1515
139.339
expr
min
lq
mean
median
uq
max
1
colWeightedMeans
1.000000
1.000000
1.000000
1.000000
1.000000
1.000000
2
rowWeightedMeans
3.697815
3.489876
3.364036
3.419401
3.326653
2.324254
Figure: Benchmarking of colWeightedMeans() and rowWeightedMeans() on 100x100 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds.
1000x10 matrix
>X<-data[["1000x10"]]
>w<- runif(nrow(X))
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells3222179172.15709258305.05709258305.0Vcells642369449.122345847170.556666022432.4>colStats<- microbenchmark(colWeightedMeans= colWeightedMeans(X, w=w, na.rm=FALSE), `apply+weigthed.mean`= apply(X,
+MARGIN=2L, FUN=weighted.mean, w=w, na.rm=FALSE), unit="ms")
>X<- t(X)
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells3222170172.15709258305.05709258305.0Vcells643373249.122345847170.556666022432.4>rowStats<- microbenchmark(rowWeightedMeans= rowWeightedMeans(X, w=w, na.rm=FALSE), `apply+weigthed.mean`= apply(X,
+MARGIN=1L, FUN=weighted.mean, w=w, na.rm=FALSE), unit="ms")
Table: Benchmarking of colWeightedMeans() and apply+weigthed.mean() on 1000x10 data. The top panel shows times in milliseconds and the bottom panel shows relative times.
expr
min
lq
mean
median
uq
max
1
colWeightedMeans
0.038679
0.0414205
0.0440360
0.043397
0.044463
0.127149
2
apply+weigthed.mean
0.206058
0.2166725
0.2233923
0.223155
0.228157
0.290184
expr
min
lq
mean
median
uq
max
1
colWeightedMeans
1.000000
1.000000
1.000000
1.000000
1.00000
1.000000
2
apply+weigthed.mean
5.327387
5.231045
5.072946
5.142176
5.13139
2.282236
Table: Benchmarking of rowWeightedMeans() and apply+weigthed.mean() on 1000x10 data (transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
expr
min
lq
mean
median
uq
max
1
rowWeightedMeans
0.114099
0.1158545
0.1182368
0.117336
0.1186590
0.180816
2
apply+weigthed.mean
0.161699
0.1643335
0.1751542
0.169834
0.1829515
0.233958
expr
min
lq
mean
median
uq
max
1
rowWeightedMeans
1.000000
1.000000
1.000000
1.000000
1.000000
1.000000
2
apply+weigthed.mean
1.417182
1.418447
1.481385
1.447416
1.541826
1.293901
Figure: Benchmarking of colWeightedMeans() and apply+weigthed.mean() on 1000x10 data as well as rowWeightedMeans() and apply+weigthed.mean() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.
Table: Benchmarking of colWeightedMeans() and rowWeightedMeans() on 1000x10 data (original and transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
expr
min
lq
mean
median
uq
max
1
colWeightedMeans
38.679
41.4205
44.03601
43.397
44.463
127.149
2
rowWeightedMeans
114.099
115.8545
118.23683
117.336
118.659
180.816
expr
min
lq
mean
median
uq
max
1
colWeightedMeans
1.000000
1.000000
1.000000
1.000000
1.000000
1.00000
2
rowWeightedMeans
2.949895
2.797033
2.685003
2.703781
2.668713
1.42208
Figure: Benchmarking of colWeightedMeans() and rowWeightedMeans() on 1000x10 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds.
10x1000 matrix
>X<-data[["10x1000"]]
>w<- runif(nrow(X))
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells3222374172.15709258305.05709258305.0Vcells642349049.122345847170.556666022432.4>colStats<- microbenchmark(colWeightedMeans= colWeightedMeans(X, w=w, na.rm=FALSE), `apply+weigthed.mean`= apply(X,
+MARGIN=2L, FUN=weighted.mean, w=w, na.rm=FALSE), unit="ms")
>X<- t(X)
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells3222368172.15709258305.05709258305.0Vcells643353349.122345847170.556666022432.4>rowStats<- microbenchmark(rowWeightedMeans= rowWeightedMeans(X, w=w, na.rm=FALSE), `apply+weigthed.mean`= apply(X,
+MARGIN=1L, FUN=weighted.mean, w=w, na.rm=FALSE), unit="ms")
Table: Benchmarking of colWeightedMeans() and apply+weigthed.mean() on 10x1000 data. The top panel shows times in milliseconds and the bottom panel shows relative times.
expr
min
lq
mean
median
uq
max
1
colWeightedMeans
0.028433
0.030165
0.0359748
0.033409
0.038258
0.10123
2
apply+weigthed.mean
4.349560
4.494647
4.7989474
4.656507
4.792277
11.09634
expr
min
lq
mean
median
uq
max
1
colWeightedMeans
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
2
apply+weigthed.mean
152.9758
149.0021
133.3976
139.3788
125.2621
109.6151
Table: Benchmarking of rowWeightedMeans() and apply+weigthed.mean() on 10x1000 data (transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
expr
min
lq
mean
median
uq
max
1
rowWeightedMeans
0.099616
0.1016885
0.1137857
0.1069615
0.119232
0.173575
2
apply+weigthed.mean
4.433739
4.5614075
4.9078075
4.6794500
4.797594
10.898394
expr
min
lq
mean
median
uq
max
1
rowWeightedMeans
1.0000
1.00000
1.00000
1.00000
1.00000
1.00000
2
apply+weigthed.mean
44.5083
44.85667
43.13202
43.74892
40.23747
62.78781
Figure: Benchmarking of colWeightedMeans() and apply+weigthed.mean() on 10x1000 data as well as rowWeightedMeans() and apply+weigthed.mean() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.
Table: Benchmarking of colWeightedMeans() and rowWeightedMeans() on 10x1000 data (original and transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
expr
min
lq
mean
median
uq
max
1
colWeightedMeans
28.433
30.1650
35.97476
33.4090
38.258
101.230
2
rowWeightedMeans
99.616
101.6885
113.78570
106.9615
119.232
173.575
expr
min
lq
mean
median
uq
max
1
colWeightedMeans
1.000000
1.000000
1.000000
1.000000
1.000000
1.00000
2
rowWeightedMeans
3.503535
3.371076
3.162932
3.201577
3.116525
1.71466
Figure: Benchmarking of colWeightedMeans() and rowWeightedMeans() on 10x1000 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds.
100x1000 matrix
>X<-data[["100x1000"]]
>w<- runif(nrow(X))
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells3222567172.25709258305.05709258305.0Vcells642408849.122345847170.556666022432.4>colStats<- microbenchmark(colWeightedMeans= colWeightedMeans(X, w=w, na.rm=FALSE), `apply+weigthed.mean`= apply(X,
+MARGIN=2L, FUN=weighted.mean, w=w, na.rm=FALSE), unit="ms")
>X<- t(X)
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells3222558172.25709258305.05709258305.0Vcells652412649.822345847170.556666022432.4>rowStats<- microbenchmark(rowWeightedMeans= rowWeightedMeans(X, w=w, na.rm=FALSE), `apply+weigthed.mean`= apply(X,
+MARGIN=1L, FUN=weighted.mean, w=w, na.rm=FALSE), unit="ms")
Table: Benchmarking of colWeightedMeans() and apply+weigthed.mean() on 100x1000 data. The top panel shows times in milliseconds and the bottom panel shows relative times.
expr
min
lq
mean
median
uq
max
1
colWeightedMeans
0.168430
0.214824
0.5719912
0.2336885
0.2628565
16.14153
2
apply+weigthed.mean
5.864435
5.987965
6.7585538
6.0624905
6.4554550
27.67489
expr
min
lq
mean
median
uq
max
1
colWeightedMeans
1.00000
1.00000
1.00000
1.00000
1.00000
1.000000
2
apply+weigthed.mean
34.81823
27.87382
11.81584
25.94261
24.55886
1.714515
Table: Benchmarking of rowWeightedMeans() and apply+weigthed.mean() on 100x1000 data (transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
expr
min
lq
mean
median
uq
max
1
rowWeightedMeans
0.899402
0.908582
0.9750369
0.9174375
0.983048
1.508171
2
apply+weigthed.mean
5.551639
5.648465
6.6217834
5.6926085
6.169376
23.063148
expr
min
lq
mean
median
uq
max
1
rowWeightedMeans
1.000000
1.000000
1.000000
1.000000
1.000000
1.00000
2
apply+weigthed.mean
6.172589
6.216792
6.791315
6.204901
6.275763
15.29213
Figure: Benchmarking of colWeightedMeans() and apply+weigthed.mean() on 100x1000 data as well as rowWeightedMeans() and apply+weigthed.mean() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.
Table: Benchmarking of colWeightedMeans() and rowWeightedMeans() on 100x1000 data (original and transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
expr
min
lq
mean
median
uq
max
1
colWeightedMeans
168.430
214.824
571.9911
233.6885
262.8565
16141.528
2
rowWeightedMeans
899.402
908.582
975.0369
917.4375
983.0480
1508.171
expr
min
lq
mean
median
uq
max
1
colWeightedMeans
1.000000
1.000000
1.000000
1.000000
1.000000
1.0000000
2
rowWeightedMeans
5.339916
4.229425
1.704636
3.925899
3.739866
0.0934342
Figure: Benchmarking of colWeightedMeans() and rowWeightedMeans() on 100x1000 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds.
1000x100 matrix
>X<-data[["1000x100"]]
>w<- runif(nrow(X))
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells3222754172.25709258305.05709258305.0Vcells642562749.122345847170.556666022432.4>colStats<- microbenchmark(colWeightedMeans= colWeightedMeans(X, w=w, na.rm=FALSE), `apply+weigthed.mean`= apply(X,
+MARGIN=2L, FUN=weighted.mean, w=w, na.rm=FALSE), unit="ms")
>X<- t(X)
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells3222745172.25709258305.05709258305.0Vcells652566549.822345847170.556666022432.4>rowStats<- microbenchmark(rowWeightedMeans= rowWeightedMeans(X, w=w, na.rm=FALSE), `apply+weigthed.mean`= apply(X,
+MARGIN=1L, FUN=weighted.mean, w=w, na.rm=FALSE), unit="ms")
Table: Benchmarking of colWeightedMeans() and apply+weigthed.mean() on 1000x100 data. The top panel shows times in milliseconds and the bottom panel shows relative times.
expr
min
lq
mean
median
uq
max
1
colWeightedMeans
0.193951
0.209496
0.3010527
0.227436
0.2476485
7.450469
2
apply+weigthed.mean
1.477644
1.540457
1.9163656
1.674757
1.8800335
9.139492
expr
min
lq
mean
median
uq
max
1
colWeightedMeans
1.000000
1.000000
1.000000
1.000000
1.00000
1.0000
2
apply+weigthed.mean
7.618646
7.353157
6.365549
7.363643
7.59154
1.2267
Table: Benchmarking of rowWeightedMeans() and apply+weigthed.mean() on 1000x100 data (transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
expr
min
lq
mean
median
uq
max
1
rowWeightedMeans
0.922334
0.930577
1.003068
0.956406
1.044642
1.227156
2
apply+weigthed.mean
1.504050
1.524069
1.948271
1.593894
1.827955
8.985222
expr
min
lq
mean
median
uq
max
1
rowWeightedMeans
1.0000
1.000000
1.000000
1.000000
1.000000
1.000000
2
apply+weigthed.mean
1.6307
1.637768
1.942313
1.666546
1.749839
7.321988
Figure: Benchmarking of colWeightedMeans() and apply+weigthed.mean() on 1000x100 data as well as rowWeightedMeans() and apply+weigthed.mean() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.
Table: Benchmarking of colWeightedMeans() and rowWeightedMeans() on 1000x100 data (original and transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
expr
min
lq
mean
median
uq
max
1
colWeightedMeans
193.951
209.496
301.0527
227.436
247.6485
7450.469
2
rowWeightedMeans
922.334
930.577
1003.0679
956.406
1044.6420
1227.156
expr
min
lq
mean
median
uq
max
1
colWeightedMeans
1.0000
1.00000
1.000000
1.000000
1.000000
1.0000000
2
rowWeightedMeans
4.7555
4.44198
3.331869
4.205165
4.218245
0.1647086
Figure: Benchmarking of colWeightedMeans() and rowWeightedMeans() on 1000x100 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds.