Skip to contents

Computes the paired two-sample Student's t-test for each feature.

See the Details section below for further information.

Usage

rowPairedT(
  x,
  g,
  null = 0,
  alternative = c("two.sided", "greater", "less"),
  conf.level = 0.95
)

Arguments

x

matrix or data.frame.

g

a vector or factor object giving the group for the corresponding elements of x.

null

numerical value or numeric vector of length nrow(x). The true values of the difference in means between the two groups of observations for each row.

alternative

character string or vector of length nrow(x). The alternative hypothesis for each row of x. Values must be one of "two.sided" (default), "greater" or "less".

conf.level

numerical value or numeric vector of length nrow(x). The confidence levels of the intervals. All values must be in the range of \([0:1]\) or NA.

Value

A list containing two elements:

statistic

A numeric vector, the values of the test statistic

significance

A numeric vector, the p-values of the selected test

Details

It is a wrapper to row_t_paired function.

Author

Alessandro Barberis

Examples

#Seed
set.seed(1010)

#Data
x = matrix(rnorm(100 * 20), 100, 20)
g = c(rep(0,10),rep(1,10))

#Compute
rowPairedT(x = x, g = g)
#> $statistic
#>   [1]  0.105846642 -1.226066457  0.933934421 -1.188231761  3.464396651
#>   [6]  0.842077479  1.144499292 -0.173302153 -0.806080402  0.558394598
#>  [11] -0.985378713 -2.713690594 -0.653815335 -1.654687005  1.031975003
#>  [16] -0.494881934  0.449574782 -1.803658453  0.215272438  0.139165914
#>  [21] -0.356861393  3.426546800 -2.032570216 -1.047425674 -0.579835348
#>  [26]  0.616875137  0.575104052 -0.477912629 -1.320900894 -1.919637167
#>  [31] -0.704886562  4.363388296  2.098441892 -0.314608823 -1.731951723
#>  [36]  1.018514762 -0.296800214 -0.915867468 -1.483291946 -0.999254476
#>  [41] -0.005859077 -0.279279608 -1.187075604  0.344343077  0.938509422
#>  [46] -0.529167965  1.942391536  1.240516329  1.168882007  3.679833178
#>  [51]  2.225412187  1.375351762 -1.325044174  0.874555960  1.228400760
#>  [56] -2.935832351  0.290564498  0.135850613  1.497595462 -1.522978283
#>  [61]  0.894265416 -2.442443525  0.430641608  0.057264512 -0.179048797
#>  [66] -1.399424743 -0.858911640 -2.472199259 -1.161983005 -0.187989620
#>  [71] -0.093156228 -2.679082345 -0.308042742 -0.236298424 -0.358293729
#>  [76] -1.906006842 -0.039285775  1.956415638 -0.237303229  1.009791671
#>  [81] -0.706780344 -0.920758455  0.113955442 -0.274247407  0.648897152
#>  [86] -0.502341383  1.162301553 -0.050237610  0.285373393 -1.281896029
#>  [91]  1.014856566  2.065955751 -0.986794564  1.038803611  1.457049907
#>  [96]  0.800263487 -0.790084646 -1.367524716  1.205469111 -1.789471257
#> 
#> $significance
#>   [1] 0.918025662 0.251285313 0.374715471 0.265150997 0.007111320 0.421556589
#>   [7] 0.281941054 0.866248992 0.440974411 0.590194360 0.350185799 0.023852928
#>  [13] 0.529579909 0.132373864 0.329017211 0.632539543 0.663648866 0.104782066
#>  [19] 0.834354129 0.892383391 0.729419519 0.007549351 0.072632160 0.322216585
#>  [25] 0.576251176 0.552600390 0.579312274 0.644106442 0.219132110 0.087107106
#>  [31] 0.498715006 0.001814482 0.065283135 0.760229868 0.117325052 0.335030238
#>  [37] 0.773354682 0.383620146 0.172147130 0.343778169 0.995452976 0.786341966
#>  [43] 0.265584277 0.738497450 0.372484537 0.609490560 0.083986374 0.246148506
#>  [49] 0.272477973 0.005076784 0.053092953 0.202284235 0.217809707 0.404548850
#>  [55] 0.250449590 0.016598828 0.777968661 0.894929437 0.168463117 0.162096094
#>  [61] 0.394465405 0.037215173 0.676858202 0.955585711 0.861865313 0.195195361
#>  [67] 0.412680398 0.035442158 0.275129352 0.855055017 0.927820245 0.025243991
#>  [73] 0.765059856 0.818491190 0.728383631 0.089028641 0.969520207 0.082116053
#>  [79] 0.817735236 0.338971204 0.497592376 0.381194616 0.911774743 0.790085272
#>  [85] 0.532611568 0.627487859 0.275006476 0.961030320 0.781816739 0.231914966
#>  [91] 0.336678726 0.068813325 0.349527929 0.325998229 0.179089885 0.444167975
#>  [97] 0.449793471 0.204636031 0.258758723 0.107160561
#>