analyzeAssociations {midasHLA} | R Documentation

## Association analysis

### Description

`analyzeAssociations` perform association analysis on a single variable level using a statistical model of choice.

### Usage

    analyzeAssociations(
      object,
      variables,
      placeholder = "term",
      correction = "bonferroni",
      n_correction = NULL,
      exponentiate = FALSE
    )

### Arguments

`object` | An existing fit from a model function such as lm, glm and many others.
`variables` | Character vector specifying variables to use in association tests.
`placeholder` | String specifying term in `object`'s formula which should be substituted with variables during analysis.
`correction` | String specifying multiple testing correction method. See details for further information.
`n_correction` | Integer specifying number of comparisons to consider during multiple testing correction calculations. For Bonferroni correction it is possible to specify a number lower than the number of comparisons being made. This is useful in cases when knowledge about the biology or redundance of alleles reduces the need for correction. For other methods it must be at least equal to the number of comparisons being made; only set this (to non-default) when you know what you are doing!
`exponentiate` | Logical flag indicating whether or not to exponentiate the coefficient estimates. Internally this is passed to `tidy`. This is typical for logistic and multinomial regressions, but a bad idea if there is no log or logit link. Defaults to FALSE.

### Details

`correction` specifies p-value adjustment method to use, common choice is Benjamini & Hochberg (1995) (`"BH"`). Internally this is passed to p.adjust.

### Value

Tibble containing combined results for all `variables`. The first column `"term"` hold the names of `variables`. Further columns depends on the used model and are determined by associated `tidy` function. Generally they will include `"estimate"`, `"std.error"`, `"statistic"`, `"p.value"`, `"conf.low"`, `"conf.high"`, `"p.adjusted"`.

### Examples

    midas <- prepareMiDAS(hla_calls = MiDAS_tut_HLA,
                          colData = MiDAS_tut_pheno,
                          experiment = "hla_alleles")

    # analyzeAssociations expects model data to be a data.frame
    midas_data <- as.data.frame(midas)

    # define base model
    object <- lm(disease ~ term, data = midas_data)

    # test for alleles associations
    analyzeAssociations(object = object,
                        variables = c("B*14:02", "DRB1*11:01"))

[Package midasHLA version 1.2.0 Index]