perform_lmer: Linear mixed models

View source: R/stats.R

perform_lmerR Documentation

Linear mixed models

Description

Fits a linear mixed model separately for each feature. Returns all relevant statistics. CITATION: When using this function, cite lme4 and lmerTest packages

Usage

perform_lmer(
  object,
  formula_char,
  all_features = FALSE,
  ci_method = c("Wald", "profile", "boot"),
  test_random = FALSE,
  ...
)

Arguments

object

a MetaboSet object

formula_char

character, the formula to be used in the linear model (see Details)

all_features

should all features be included in FDR correction?

ci_method

The method for calculating the confidence intervals, see documentation of confint below

test_random

logical, whether tests for the significance of the random effects should be performed

...

additional parameters passed to lmer

Details

The model is fit on combined_data(object). Thus, column names in pData(object) can be specified. To make the formulas flexible, the word "Feature" must be used to signal the role of the features in the formula. "Feature" will be replaced by the actual Feature IDs during model fitting, see the example

Value

a data frame with one row per feature, with all the relevant statistics of the linear mixed model as columns

See Also

lmer for model specification and confint.merMod for the computation of confidence intervals

Examples

# A simple example without QC samples
# Features predicted by Group and Time as fixed effects with Subject ID as a random effect
## Not run: 
lmer_results <- perform_lmer(drop_qcs(example_set),
  formula_char = "Feature ~ Group + Time + (1 | Subject_ID)",
  ci_method = "Wald"
)

## End(Not run)

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