fitModels {benchdamic} | R Documentation

## fitModels

### Description

A wrapper function that fits the specified models for each taxon of the count data and computes the mean difference (MD) and zero probability difference (ZPD) between estimated and observed values.

### Usage

    fitModels(
      counts,
      models = c("NB", "ZINB", "DM", "ZIG", "HURDLE"),
      scale_ZIG = c("default", "median"),
      scale_HURDLE = c("default", "median"),
      verbose = TRUE
    )

### Arguments

`counts` | a phyloseq object or a matrix of counts with features (OTUs, ASVs, genes) by row and samples by column.
`models` | character vector which assumes the values `NB`, `ZINB`, `DM`, `ZIG`, and `HURDLE`.
`scale_ZIG` | character vector, either `median` or `default` to choose between the median of the library size or one thousand to scale normalization factors for the zero-inflated gaussian model.
`scale_HURDLE` | character vector, either `median` or `default` to choose between the median of the library size or one million to scale raw counts for the truncated gaussian hurdle model.
`verbose` | an optional logical value. If `TRUE` information on the steps of the algorithm is printed. Default `verbose = TRUE`.

### Value

list of `data.frame` objects for each model. The first two columns contain the properly transformed observed values for mean and zero proportion, while the third and the fourth columns contain the estimated values for the mean and the zero rate respectively.

### See Also

`fitNB`, `fitZINB`, `fitDM`, `fitZIG`, and `fitHURDLE` for the model estimations, `prepareObserved` for raw counts preparation, and `meanDifferences` for the Mean Difference (MD) and Zero Probability Difference (ZPD) computations.

### Examples

    # Generate some random counts
    counts <- matrix(rnbinom(n = 60, size = 3, prob = 0.5), nrow = 10, ncol = 6)
    # Estimate the counts assuming several distributions
    GOF <- fitModels(
        counts = counts, models = c(
            "NB", "ZINB",
            "DM", "ZIG", "HURDLE"
        ), scale_ZIG = c("median", "default"), scale_HURDLE =
            c("median", "default")
    )

    head(GOF)

[Package benchdamic version 1.0.0 Index]