Skip to contents

Welch's t-test

Usage

ttest(
  x,
  cls = "class",
  pAdjust = "bonferroni",
  comparisons = list(),
  returnModels = FALSE
)

# S4 method for AnalysisData
ttest(
  x,
  cls = "class",
  pAdjust = "bonferroni",
  comparisons = list(),
  returnModels = FALSE
)

Arguments

x

S4 object of class AnalysisData

cls

vector of sample information column names to analyse

pAdjust

p value adjustment method

comparisons

named list of binary comparisons to analyse

returnModels

should models be returned

Value

An S4 object of class Univariate.

Examples

library(metaboData)

d <- analysisData(abr1$neg[,200:300],abr1$fact) %>% 
 keepClasses(cls = 'day',classes = c('H','5'))

## Perform t-test
ttest_analysis <- ttest(d,cls = 'day')

## Extract significant features
explanatoryFeatures(ttest_analysis)
#> # A tibble: 11 × 14
#>    response comparison feature estimate estimate1 estimate2 statistic    p.value
#>    <chr>    <chr>      <chr>      <dbl>     <dbl>     <dbl>     <dbl>      <dbl>
#>  1 day      5~H        N277       65.4      79.2     13.8        7.77    1.58e-7
#>  2 day      5~H        N299        7.68      8.99     1.31       6.36    2.53e-6
#>  3 day      5~H        N229       50.3      55.2      4.93       5.96    8.60e-6
#>  4 day      5~H        N295        4.19      5.12     0.937      5.56    8.65e-6
#>  5 day      5~H        N233       -4.65      2.68     7.33      -5.00    1.69e-5
#>  6 day      5~H        N267       27.3      48.1     20.8        4.79    2.96e-5
#>  7 day      5~H        N245       18.0      19.9      1.94       4.92    9.00e-5
#>  8 day      5~H        N279        7.64      9.21     1.57       4.61    1.63e-4
#>  9 day      5~H        N278        4.14      6.27     2.12       4.45    1.76e-4
#> 10 day      5~H        N281        3.02      3.72     0.701      4.47    1.92e-4
#> 11 day      5~H        N272        2.99      3.71     0.722      4.30    2.49e-4
#> # ℹ 6 more variables: parameter <dbl>, conf.low <dbl>, conf.high <dbl>,
#> #   method <chr>, alternative <chr>, adjusted.p.value <dbl>