associationTest {tradeSeq} | R Documentation

## Perform statistical test to check whether gene expression is constant across pseudotime within a lineage

### Description

This test assesses whether average gene expression is associated with pseudotime.

### Usage

    associationTest(models, ...)

    ## S4 method for signature 'SingleCellExperiment'
    associationTest(
      models,
      global = TRUE,
      lineages = FALSE,
      l2fc = 0,
      nPoints = 2 * tradeSeq::nknots(models),
      contrastType = "start"
    )

    ## S4 method for signature 'list'
    associationTest(models, global = TRUE, lineages = FALSE, l2fc = 0)

### Arguments

`models` | The fitted GAMs, typically the output from `fitGAM`.
`...` | parameters including:
`global` | If TRUE, test for all lineages simultaneously.
`lineages` | If TRUE, test for all lineages independently.
`l2fc` | The log2 fold change threshold to test against. Note, that this will affect both the global test and the pairwise comparisons.
`nPoints` | The number of points used per lineage to set up the contrast. Defaults to 2 times the number of knots. Note that not all points may end up being actually used in the inference; only linearly independent contrasts will be used.
`contrastType` | The contrast used to impose the log2 fold-change threshold. Defaults to `"start"`. Three options are possible: - If `"start"`, the starting point of each lineage is used to compare against all other points, and the fold-change threshold is applied on these contrasts. - If `"end"`, the procedure is similar to `"start"`, except that the reference point will now be the endpoint of each lineage rather than the starting point. - If `"consecutive"`, then consecutive points along each lineage will be used as contrasts. This is the original way the `associationTest` was implemented and is kept for backwards compatibility. If a fold change threshold has been set, we recommend users to use either the `"start"` or `"end"` options.

### Details

If a log2 fold-change threshold has not been set, we use the QR decompositon through `qr.solve` to invert the variance-covariance matrix of the contrasts. If instead a log2 fold chalnge-threshold has been set, we invert that matrix using the Cholesky decomposition through `chol2inv`.

### Value

A matrix with the wald statistic, the degrees of freedom and the (unadjusted) p-value associated with each gene for all the tests performed. If the testing procedure was unsuccessful for a particular gene, `NA` values will be returned for that gene.

### Examples

    set.seed(8)
    data(crv, package="tradeSeq")
    data(countMatrix, package="tradeSeq")
    sce <- fitGAM(counts = as.matrix(countMatrix),
                      sds = crv,
                      nknots = 5)
    assocRes <- associationTest(sce)

[Package tradeSeq version 1.8.0 Index]