GoodnessOfFit {bsseq} | R Documentation

## Binomial and poisson goodness of fit statistics for BSSeq objects

### Description

Binomial and poisson goodness of fit statistics for BSSeq objects, including plotting capability.

### Usage

    poissonGoodnessOfFit(BSseq, nQuantiles = 10^5)
    binomialGoodnessOfFit(BSseq, method = c("MLE"), nQuantiles = 10^5)
    ## S3 method for class 'chisqGoodnessOfFit'
    print(x, ...)
    ## S3 method for class 'chisqGoodnessOfFit'
    plot(x, type = c("chisq", "pvalue"), plotCol = TRUE, qqline = TRUE,
      pch = 16, cex = 0.75, ...)

### Arguments

`BSseq` | An object of class `BSseq`.
`x` | A chisqGoodnessOfFit object (as produced by `poissonGoodnessOfFit` or `binomialGoodnessOfFit`).
`nQuantiles` | The number of (evenly-spaced) quantiles stored in the return object.
`method` | How is the parameter estimated.
`type` | Are the chisq or the p-values being plotted.
`plotCol` | Should the extreme quantiles be colored.
`qqline` | Add a `qqline`.
`pch, cex` | Plotting symbols and size.
`...` | Additional arguments being passed to `qqplot` (for `plot`) or ignored (for `print`).

### Details

These functions compute and plot goodness of fit statistics for `BSseq` objects. For each methylation loci, the Poisson goodness of fit statistic tests whether the coverage (at that loci) is independent and identically Poisson distributed across the samples. In a similar fashion, the Binomial goodness of fit statistic tests whether the number of reads supporting methylation are independent and identically binomial distributed across samples (with different size parameters given by the coverage vector).

These functions do not handle `NA` values.

### Value

The plotting method is invoked for its side effect. Both `poissonGoodnessOfFit` and `binomialGoodnessOfFit` returns an object of class `chisqGoodnessOfFit` which is a list with components

`chisq` | a vector of Chisq values.
`quantiles` | a vector of quantiles (of the chisq values).
`df` | degress of freedom

### Author(s)

Kasper Daniel Hansen khansen@jhsph.edu

### See Also

For the plotting method, see `qqplot`.

### Examples

    if(require(bsseqData)) {
      data(BS.cancer.ex)
      BS.cancer.ex <- updateObject(BS.cancer.ex)
      gof <- poissonGoodnessOfFit(BS.cancer.ex)
      plot(gof)

    #-------------------------------------------------------------------------------
    # An example using a HDF5Array-backed BSseq object
    #

        library(HDF5Array)

        # See ?SummarizedExperiment::saveHDF5SummarizedExperiment for details
        hdf5_BS.cancer.ex <- saveHDF5SummarizedExperiment(x = BS.cancer.ex,
                                                          dir = tempfile())
        hdf5_gof <- poissonGoodnessOfFit(hdf5_BS.cancer.ex)
        plot(hdf5_gof)

    }

[Package bsseq version 1.26.0 Index]