fitConstImpulse: Fits impulse and constant models to all genes on all samples...

View source: R/srcImpulseDE2_fitImpulse.R

fitConstImpulseR Documentation

Fits impulse and constant models to all genes on all samples of a condition

Description

[Model fitting function hierarchy: 2 out of 4] This secondary fitting wrapper performs parralelisation of model fitting across genes.

Usage

fitConstImpulse(matCountDataProcCondition, vecDispersions, vecSizeFactors,
  vecTimepoints, lsvecBatches, boolFitConst)

Arguments

matCountDataProcCondition

(matrix genes x samples) Read count data.

vecDispersions

(vector number of genes) Gene-wise negative binomial dispersion hyper-parameters.

vecSizeFactors

(numeric vector number of samples) Model scaling factors for each sample which take sequencing depth into account (size factors).

vecTimepoints

(numeric vector length number of samples) Time coordinates of each sample.

lsvecBatches

(list length number of confounding variables) List of vectors. One vector per confounding variable. Each vector has one entry per sample with the name of the batch ID within the given confounding variable of the given sample.

boolFitConst

(bool) Whether to fit a constant model.

Value

(list length 5)

  • lsFits (list of lists length number of genes) List of model fits for each gene. Each gene entry is a list of model fits to the individual models: Impulse model and constant model (if boolFitConst is TRUE). At this level, the sigmoid model fit can be added later. Each model fit per gene is a list of fitting parameters and results.

    • Gene ID (list length 2) Impulse and constant model fit to gene observations. One entry of this format for all gene IDs.

      • lsImpulseFit (list) List of impulse fit parameters and results.

        • vecImpulseParam (numeric vector length 6) {beta, h0, h1, h2, t1, t2} Maximum likelihood estimators of impulse model parameters.

        • vecImpulseValue (numeric vector length number of time points) Values of impulse model fit at time points used for fit.

        • lsvecBatchFactors (list length number of confounders) List of vectors of scalar batch correction factors for each sample. These are also maximum likelihood estimators. NULL if no confounders given.

        • scaDispParam (scalar) Dispersion parameter estimate used in fitting (hyper-parameter).

        • scaLL (scalar) Loglikelihood of data under maximum likelihood estimator model.

        • scaConvergence (scalar) Convergence status of optim on impulse model.

      • lsConstFit (list) List of constant fit parameters and results.

        • scaMu (scalar) Maximum likelihood estimator of negative binomial mean parameter.

        • lsvecBatchFactors (list length number of confounders) List of vectors of scalar batch correction factors for each sample. These are also maximum likelihood estimators. NULL if no confounders given.

        • scaDispParam (scalar) Dispersion parameter estimate used in fitting (hyper-parameter).

        • scaLL (scalar) Loglikelihood of data under maximum likelihood estimator model.

        • scaConvergence (scalar) Convergence status of optim on constant model.

    • vecTimepointsUnique (numeric vector length number of unique timepoints) Vector of unique time coordinates observed in this condition.

    • vecidxTimepoint (idx vector length number of samples) Index of the time coordinates of each sample (reference is vecTimepointsUnique).

    • lsvecBatchUnique (list number of confounders) List of string vectors. One vector per confounder: vector of unique batches in this confounder.

    • lsvecidxBatches (idx list length number of confounding variables) List of index vectors. One vector per confounding variable. Each vector has one entry per sample with the index of the batch ID within the given confounding variable of the given sample. Reference is the list of unique batch ids for each confounding variable.

Author(s)

David Sebastian Fischer

See Also

Called by fitModels to fit constant and impulse model to samples of one condition. Calls fitConstImpulseGene to perform fitting on each gene.


YosefLab/ImpulseDE2 documentation built on Sept. 17, 2022, 2:45 a.m.