.integrate_beta {freqpcr} | R Documentation |
Integration of likelihood function based on the beta assumption.
Description
Internal function to integrate the likelihood getting the \Delta
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 |
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- |
targetScale |
( |
sdMeasure |
( |
xsm |
Specify the accumulation of the standard deviation of the Cq measuring errors when the *-Cq values are fed as difference. For |
EPCR |
( |
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()