knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

Statistics

This vignette provides an overview of the different statistical tests provided in the package. The first section discusses univariate tests, which are repeated for each feature.

Unless otherwise stated, all functions return separate data frames or other objects with the results. These can be then added to the object feature data using join_fData(object, results). The reason for not adding these to the objects automatically is that most of the functions return excess information that is not always worth saving. We encourage you to choose which information is important to you.

Univariate functions

summary statistics and effect sizes

These functions provide summary statistics and effect sizes for all features:

Hypothesis tests

These functions perform univariate hypothesis tests for each feature, report relevant statistics and correct the p-values using FDR correction. For features, where the model fails for some reason, all statistics are recorded as NA. NOTE setting all_features = FALSE does not prevent the tests on the flagged compounds, but only affects p-value correction, where flagged features are not included in the correction and thus do not have an FDR-corrected p-value. To prevent the testing of flagged features altogether, use drop_flagged before the tests.

Formula interface

Many R functions for statistical tests use a so-called formula interface. For example, the function lm that is used for fitting linear models uses the formula interface, so when predicting the fuel consumption (mpg - miles per gallon) by the car weight (wt) in the inbuilt mtcars dataset, we would run:

lm(mpg ~ wt, data = mtcars)

For many of the univariate statistical test functions in this package use the formula interface, where the formula is provided as a character, with one special condition: the word "Feature" will get replaced at each iteration by the corresponding feature name. So for example, when testing if any of the features predict the difference between study groups, the formula would be: "Group ~ Feature". Or, when testing if group and time point affect metabolite levels, the formula could be "Feature ~ Group + Time + Group:Time", with the last term being an interaction term ("Feature ~ Group * Time" is equivalent).

Now that we know how the formula interface looks like, let's list the univariate statistical functions available:

Most of the functions allow you to pass extra arguments to the underlying functions performing the actual tests, so you can set custom contrasts etc.

Functions not using the formula interface

Some functions do not use the formula interface. They include

Multivariate functions

MUVR

notame provides a wrapper for the MUVR analysis (Multivariate methods with Unbiased Variable selection in R, MUVR package). MUVR allows fitting both RF and PLS models with clever variable selection for both finding a minimal subset of features that achieves a good performance AND for finding all relevant features.

muvr_analysis provides the wrapper for MetaboSet objects

Random forest

It is possible to fir random forest models with the randomForest package.

PLS(-DA)

There are also wrappers for PLS(-DA) functions from the mixOmics package:



antonvsdata/notame documentation built on Sept. 14, 2024, 11:09 p.m.