getAB: Estimate beads-only shape parameters

View source: R/getAB.R

getABR Documentation

Estimate beads-only shape parameters

Description

Beta shape parameters are estimated using the proportion of reads-pulled per peptide across the beads-only samples. Currently, only three estimation methods are supported: edgeR, method of moments (MOM), maximum likelihood (MLE). Note that edgeR can only be used on PhIPData objects while MOM and MLE methods can also be applied to vectors of values between 0 and 1. Parameters that can be passed to each method are listed in the details.

Usage

getAB(object, method = "mom", ...)

Arguments

object

a PhIPData object or a vector

method

one of c("edgeR", "mle", "mom") designating which method to use to estimate beads-only prior parameters. MOM is the default method used to estimate shape parameters.

...

parameters passed to specific estimating functions. See details for more information

Details

edgeR derived estimates rely on edgeR's peptide-specific dispersion estimates, denoted φ^{edgeR}. φ^{edgeR} corresponds to the squared coefficient of variation for the proportion of reads pulled for a given peptide. Using φ^{edgeR} to derive an estimate of the variance for the proportion of reads pulled by a single peptide, the mean and variance are transformed into shape parameters satisfying the lower and upper bounds. When method = "edgeR", the following additional parameters can be specified.

  • threshold.cpm: CPM threshold to be considered present in a sample.

  • threshold.prevalence: proportion of beads-only samples that surpass threshold.cpm.

  • lower: minimum value of the beta shape parameters.

  • upper: maximum value of the beta shape parameters.

Method of Moments (MOM) estimates are derived by transforming the sample mean and variance to shape parameters of the beta distribution. For method = "mom", the following parameters can be adjusted:

  • offsets: vector defining the offset to use when the mean and/or variance are zero.

  • lower: lower bound for the shape parameters.

  • upper: upper bound for the shape parameters.

  • ...: parameters passed to [base::mean] and [stats::var].

Maximum Likelihood (MLE) estimates rely on [stats::optim] to derive shape parameters that maximize the likelihood of observed data. By default the L-BFGS-B optimization method is used. Parameters for MLE estimates include:

  • prop.offset: offset to use when the proportion of reads is 0.

  • optim.method: optimization method passed to [stats::optim].

  • lower: lower bound for the shape parameters.

  • upper: upper bound for the shape parameters.

Value

a data frame of beta shape parameters where each row corresponds to a peptide.

Examples

## PhIPData object
sim_data <- readRDS(system.file("extdata", "sim_data.rds", package = "beer"))

getAB(sim_data, method = "edgeR")
getAB(sim_data, method = "mle")
getAB(sim_data, method = "mom")

## Vector of proportions
prop <- rbeta(100, 2, 8)
getAB(prop, method = "mle")
getAB(prop, method = "mom")

athchen/beer documentation built on July 2, 2022, 10:35 p.m.