Learn R Programming

qpcR (version 1.4-1)

predict.pcrfit: 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 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 "y" (default) for prediction of the raw fluorescence or "x" for prediction of the cycle number.

interval

if not "none", confidence or prediction intervals are calculated.

level

the confidence level.

...

some methods for this generic require additional arguments. None are used in this method.

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.

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).

Examples

Run this code
# NOT RUN {
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")
# }

Run the code above in your browser using DataLab