association_study: Perform association study

View source: R/association_studies.R

association_studyR Documentation

Perform association study

Description

This function is a wrapper around the function test_association. This function tests associations between multiple variables by repeatedly calling the function test_association. Standard, all possible single associations between pairs of variables in the given data frame are tested.

Usage

association_study(
  data,
  response.var = NULL,
  vars.to.select = tidyselect::everything(),
  stratum = NULL,
  ...
)

Arguments

data

data frame to use

response.var

Character value, optional. Response variable. If provided, associations will only be tested for this single response variable.

vars.to.select

Variables to select. Will be used within dplyr::select. All possible pairs of associations between these variables will be tested. Standard all variables will be selected.

stratum

character vector. When used, the tests will be blocked by these variables.

...

other parameters that will be parsed to test_association.

Details

The response variables are columns in a data frame and their column names should be given in a character string.

Note 2: Associations can be stratified (see options for test_association). All strata/blocks should contain enough observations.

Value

data frame with results as output

See Also

test_association for further arguments that can be used (for example, changing the resampling number n.resample), BH_selection for applying the Benjamini-Hochberg selection procedure based on False Discovery Rate.

Examples

## Test pairwise associations between all variables in a a data frame:
association_study(immune_data[, 1:10])

## Test associations of a response variable with all other variables in a data frame:
association_study(immune_data, "Frailty.index")

## Test associations with a selection of variables:
association_study(immune_data, "Frailty.index", c(Tregs, Neutrophils))

## Excluding variables is also possible:
association_study(immune_data, "Frailty.index", -c(Tregs, Neutrophils))

## as well as using a blocked design:
association_study(immune_data, "Frailty.index", -c(Tregs, Neutrophils),
stratum = c("Batch", "Sex"))


LDSamson/associationstudies documentation built on April 14, 2025, 11:52 a.m.