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 results using join_results(object, results)

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 alltogether, 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:

Functions not using the formula interface

Some functions do not use the formula interface. They include

Model diagnostics

Model diagnostics visalizations are currently available for linear models and linear mixed models, see documenation of save_lm_diagnostic_plots.

Multivariate functions

Random forest

PLS-DA

Not yet implemented, but coming soon!



antonvsdata/amp documentation built on Jan. 8, 2020, 3:15 a.m.