multi_aov: Perform multiple analyses of variance on linear model...

Description Usage Arguments Details Value Examples

Description

Given a list of linear models (the results of calls to stats::lm() or MASS::rlm()), all of which used the same explanatory variables with the same dataset (most likely the output of a call to multi_lm()), perform analyses of variance on all of them and arrange the result into a single data frame.

Usage

1
multi_aov(lms, lms_data = NULL, type = 1)

Arguments

lms

A list of fitted linear models (the results of calls to stats::lm() or MASS::rlm()). Most likely, the output of a call to multi_lm().

lms_data

The data frame that was passed as the df argument to multi_lm(), if multi_lm() was used to create lms.

type

The type of sum of squares to use. Types I and II are currently supported. Type I can be used with either default or robust linear models, but type II cannot be used with robust linear models.

Details

lms_data is needed to ensure that the elements of the y column in the return match the input. You should provide this argument if you can at all.

Value

An object of class mirmodels_multi_aov_df. A long data frame with columns:

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
if (requireNamespace("mirmisc")) {
  gars_data <- get_combined_cohort_data(c("ga", "rs"), log2 = TRUE) %>%
    dplyr::mutate(
      cohort = factor(
        dplyr::if_else(startsWith(mirvie_id, "RS"), "RS", "GA")
      ),
      meta_major_race = forcats::fct_drop(meta_major_race)
    ) %>%
    dplyr::filter(!is.na(meta_collectionga), !is.na(meta_major_race))
  xs <- c("cohort", "meta_major_race", "meta_collectionga")
  ys <- gars_data %>%
    dplyr::select(dplyr::any_of(mirmisc::get_gene_names())) %>%
    purrr::map_dbl(sum) %>%
    sort() %>%
    tail(100) %>%
    names() # ys are the highest expressed 100 genes
  lms <- multi_lm(gars_data, xs, ys, robust = TRUE)
  aovs <- multi_aov(lms)
  summary(aovs)
}

mirvie/mirmodels documentation built on Jan. 14, 2022, 11:12 a.m.