View source: R/association_studies.R
association_study | R Documentation |
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.
association_study(
data,
response.var = NULL,
vars.to.select = tidyselect::everything(),
stratum = NULL,
...
)
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 |
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.
data frame with results as output
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.
## 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"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.