fitGAM {tradeSeq} | R Documentation

## fitGAM

### Description

This fits the NB-GAM model as described in Van den Berge et al.[2019]

### Usage

    fitGAM(counts, ...)

    ## S4 method for signature 'matrix'
    fitGAM(counts, sds = NULL, pseudotime = NULL,
      cellWeights = NULL, U = NULL, weights = NULL, offset = NULL,
      nknots = 6, verbose = TRUE, parallel = FALSE,
      BPPARAM = BiocParallel::bpparam(), control = mgcv::gam.control(),
      sce = FALSE, family = "nb")

### Arguments

`counts` | the count matrix.
`...` | parameters including:
`sds` | an object of class `SlingshotDataSet`, typically obtained after running Slingshot. If this is provided, `pseudotime` and `cellWeights` arguments are derived from this object.
`pseudotime` | a matrix of pseudotime values, each row represents a cell and each column represents a lineage.
`cellWeights` | a matrix of cell weights defining the probability that a cell belongs to a particular lineage. Each row represents a cell and each column represents a lineage.
`U` | the design matrix of fixed effects. The design matrix should not contain an intercept to ensure identifiability.
`weights` | a matrix of weights with identical dimensions as the `counts` matrix. Usually a matrix of zero-inflation weights.
`offset` | the offset, on log-scale. If NULL, TMM is used to account for differences in sequencing depth., see `edgeR::calcNormFactors`. Alternatively, this may also be a matrix of the same dimensions as the expression matrix.
`nknots` | Number of knots used to fit the GAM. Defaults to 6.
`verbose` | Logical, should progress be printed?
`parallel` | Logical, defaults to FALSE. Set to TRUE if you want to parallellize the fitting.
`BPPARAM` | object of class `bpparamClass` that specifies the back-end to be used for computations. See `bpparam` in `BiocParallel` package for details.
`control` | Variables to control fitting of the GAM, see `gam.control`.
`sce` | Should output be of SingleCellExperiment class? This argument should not be changed by users.
`family` | The assumed distribution for the response, set to `"nb"` by default.

### Value

A list of length the number of genes (number of rows of `counts`). Each element of the list is either a `gamObject` if the fiting procedure converged, or an error message.

### Examples

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

[Package tradeSeq version 1.0.1 Index]