predict.pcrfit {qpcR} | R Documentation |
Value prediction from a fitted qPCR model
Description
After fitting the appropriate model, either the raw fluorescence values can be predicted from the cycle number or vice versa.
Usage
## S3 method for class 'pcrfit'
predict(object, newdata, which = c("y", "x"),
interval = c("none", "confidence", "prediction"),
level = 0.95, ...)
Arguments
object |
an object of class 'pcrfit'. |
newdata |
a dataframe containing the values to estimate from, using the same variable naming as in the fitted model. |
which |
either |
interval |
if not |
level |
the confidence level. |
... |
some methods for this generic require additional arguments. None are used in this method. |
Details
y-values (Fluorescence) are estimated from object$MODEL$expr
, x-values (Cycles) are estimated from object$MODEL$inv
. Confidence intervals are calculated from the gradient of the function and the variance-covariance matrix of object
by \nabla f(x) \cdot cov(y) \cdot \nabla f(x)
and are based on asymptotic normality (t-distribution).
Value
A dataframe containing the estimated values and (if chosen) standard error/upper confidence limit/lower confidence limit.
The gradient is attached to the dataframe and can be accessed with attr
.
Note
The estimation of x (cycles) from fluorescence data if which = "x"
is problematic in the asymptotic regions of the sigmoidal curves
(often gives NaN, due to logarithmation of negative values) and works fairly well in the ascending part.
Author(s)
Andrej-Nikolai Spiess
Examples
m1 <- pcrfit(reps, 1, 2, l5)
## Which raw fluorescence value at cycle number = 17?
predict(m1, newdata = data.frame(Cycles = 17))
## Cycle numbers 20:25, with 95% confidence?
predict(m1, newdata = data.frame(Cycles = 20:25), interval = "confidence")
## Which cycle at Fluo = 4, with 95% prediction?
predict(m1, newdata = data.frame(Fluo = 4), which = "x", interval = "prediction")