Learn R Programming

qpcR (version 1.3-2)

plot.pcrfit: Plotting qPCR data with fitted curves/confidence bands/error bars

Description

A plotting function for data of class 'pcrfit' (single curves), 'modlist' (batch curves) or 'replist' (replicate curves) displaying the data points, the fitted curve and (if desired) confidence/prediction bands/error bars on replicates. Three different plot types are available, namely plotting all curves in 2D graphs, 3D graphs or a plot matrix with one graph per curve.

Usage

## S3 method for class 'pcrfit':
plot(x, which = c("all", "single", "3D"), fitted = TRUE,  
        add = FALSE, col = NULL, 
        confband = c("none", "confidence", "prediction"),
        errbar = c("none", "sd", "se", "conf"), par3D = list(), 
        par2D = list(), parCI = list(), parSD = list(),  ...)

Arguments

x
an object of class 'pcrfit', 'modlist' or 'replist'.
which
plots all curves in 2D (all), 3D (3D) or a plot matrix with many curves (single).
fitted
should the fitted lines be displayed?
add
should the curve be added to an existing plot?
col
an optional color vector for the individual curves. Is recycled to the number of runs in x.
confband
should confidence/prediction bands be displayed? See confint.
errbar
the type of error bar on the plot if replicates exist. See 'Examples'.
par3D
a list containing graphical parameters to change the 3D-plot: plot3d, points3d, lines3d,
par2D
a list containing graphical parameters to change the 2D-plots: plot, points or lines.
parCI
a list containing graphical parameters to change the confidence band: lines.
parSD
a list containing graphical parameters to change the error bars: arrows.
...
other parameters to be passed to predict.

Value

  • A 2D, multiple 2D or 3D qPCR plot. If object was of class 'replist', colour coding of the curves is done automatically (but can be overridden).

Details

Uses the 'rgl' package for 3D plots. If the 'modlist' contains runs that failed to fit, these are displayed with RED asterisked names. Additionally, if an outlier method such as KOD or SOD was applied on the 'modlist' with option remove = FALSE, outlier runs will be displayed in BLUE with double asterisked names. This approach makes the identification of failed runs easy and works only with which = "single". See 'Examples'.

Examples

Run this code
## single plot
m1 <- pcrfit(reps, 1, 2, l5)
plot(m1)

## add another plot in blue
## with 99\% confidence interval
m2 <- pcrfit(reps, 1, 12, l5)
plot(m2, add = TRUE, col = 4, confband = "confidence", level = 0.99)

## plot a 'modlist' batch with coloring of replicates
ml <- modlist(reps, 1, 2:13, model = l4)
plot(ml, col = gl(3,4))   

## only the fitted curves
## and a subset of data
plot(ml, type = "l", col = rep(1:3, each = 4), 
     par2D = list(xlim = c(10, 30)))

## plot a 'replist'
rl <- replist(ml, group = gl(3, 4))
plot(rl)

## standard deviation instead of 
## replicate points; suppress plotting
## of point symbols
plot(rl, type = "l", errbar = "sd",
     par2D = list(pch = ""))

## 95\% confidence values
plot(rl, errbar = "conf", 
     par2D = list(pch = ""))

## plot single curves.
## good for diagnostics...
plot(ml, which = "single", col = rep(1:3, each = 4))

## 3D plots of 'modlist's or 'replist's
plot(ml, which = "3D", col = rep(1:3, each = 4))
rgl.close()
plot(rl, which = "3D")
rgl.close()

## example for outlier identification
## RED/*name* indicates failed fitting,
## BLUE/**name** indicates outlier (KOD or SOD)
## spike a failed run into 'reps' dataset 
dat <- reps
dat[, 10] <- rep(1, 49)
ml <- modlist(dat)
plot(ml, which = "single")

Run the code above in your browser using DataLab