dot-integrate_beta: Integration of likelihood function based on the beta...

.integrate_betaR Documentation

Integration of likelihood function based on the beta assumption.

Description

Internal function to integrate the likelihood getting the ΔCq value (the argument del) over the entire range of the allele ratio (0 to 1). Vectorized for multiple bulk samples. Having the same arguments with .integrate_gamma.

Usage

.integrate_beta(
  del,
  SHR,
  SHS,
  zeroAmount,
  targetScale,
  sdMeasure,
  xsm = 2,
  EPCR,
  cubmethod = "hcubature",
  relTol = 0.1,
  absTol = 1e-08,
  maxEval = 10^6
)

Arguments

del

Numeric vector of the observed ΔCq values.

SHR

The gamma shape parameters for the mutant (R) portion of the bulk samples. Should be the same vector length as del. Each element of SHR is defined as K*(the assumed number of R allele in the bulk sample: 1, 2, 3, ..., n-1).

SHS

The gamma shape parameters for the wild (S) portion of the bulk samples. Should be the same length as del. Each element of SHS is defined as K*(the assumed number of S allele in the bulk sample).

zeroAmount

(In RED-ΔΔCq method) residue rate of restriction enzyme digestion, or (in general ΔΔCq analyses) small portion of the off-target allele on the target locus of the test sample, which will be amplified in the PCR. It needs to be always specified by the user as a number between 0 and 1, usually near 0.

targetScale

(δ_{T}) Scalar. The relative template DNA amount of the target locus to the houskeeping locus. If known, given as a positive numeric.

sdMeasure

(σ_{c}) Scalar. The measurement error (standard deviation) on each Cq value following Normal(0, σ_{c}^2). If known, given as a positive numeric.

xsm

Specify the accumulation of the standard deviation of the Cq measuring errors when the *-Cq values are fed as difference. For ΔCq values, sdMeasure times two. For ΔΔCq, sdMeasure times four. Default is two and used in most cases.

EPCR

(η) Scalar. Amplification efficiency per PCR cycle. If known, given as a positive numeric. When EPCR = 1, template DNA doubles every cycle (EPCR + 1 = 2).

cubmethod

Cubature method passed to the integrator function. See the section "Methods for cubintegrate".

relTol

The maximum tolerance passed to the cubature method. Though the default of cubature::cubintegrate function is 1e-5, the accuracy is reduced here to acceralate the integration.

absTol

The absolute tolerance passed to the cubature method. The default is 1e-8, which is less accurate than the default of cubintegrate function (1e-12) but considered enough for the estimation.

maxEval

Maximum number of function evaluations needed. The default is 10^6, which is same as the cubintegrate default.

Value

A numeric vector of marginal likelihoods having the same length as del.

Methods for cubintegrate

The following methods are available for cubintegrate(): cubmethod = c("hcubature", "pcubature", "cuhre", "divonne", "suave", "vegas").
hcubature is considerably fast, but less accurate with larger reltol. cuhre is moderately fast and the most accurate in most relTol range. If you can wait longer, hcubature with relTol = 1e-4 or cuhre with relTol = 1e-1 is recommended. At reltol = 1e-1, hcubature is three times faster than cuhre, but the log-likelihood fluctuate by 0.1 (by 0.001 in cuhre). The speed and accuracy of hcubature at reltol = 1e-5 is comparable with cuhre at reltol = 1e-1.
pcubature and divonne frequently returns NaN and are not recommended.
suave and vegas are Monte Carlo integration and slow. They are certainly accurate even at reltol = 1, but interior to cuhre with same reltol.

See Also

Other integrators: .integrate_gamma()


freqpcr documentation built on March 18, 2022, 7:25 p.m.