Learn R Programming

qpcR (version 1.2-1)

pcrfit: Function for qPCR model fitting

Description

This is the main workhorse function of the qpcR package that fits one of the available models to qpcR data using non-linear least squares fitting from nls, with sensible starting parameters obtained from optim.

Usage

pcrfit(data, cyc = 1, fluo, model = l4, do.optim = TRUE,  
       opt.method = rep("Nelder", 5), nls.method = "port", 
       start = NULL, ...)

Arguments

data
the name of the dataframe containing the qpcR runs.
cyc
the column number with the cycle data. Defaults to 1.
fluo
the column containing the raw fluorescence data of the run.
model
the model to be used for the analysis, defaults to l4.
do.optim
if FALSE, refinement of starting values by optim will be skipped.
opt.method
one of the available methods in optim or "GA". See 'Details'.
nls.method
one of the available methods in nls. Default is "port", which is quite robust.
start
a vector of starting values that can be supplied externally.
...
other parameters to be passed to optim, genoud or nls.

Value

  • A model of class 'nls' and 'pcrfit' with the following items attached:
  • DATAthe initial data used for fitting.
  • MODELthe model used for fitting.
  • parMatthe trace of the starting values for each applied method. Can be used to track problems.
  • opt.methodthe parameter opt.method.

encoding

latin1

Details

The fitting procedure works as follows (hopefully ensuring maximum robustness against fitting errors): 1) Approximate starting values are acquired from model$ssfct. 2) Starting values are refined by any of the methods available in optim or the genoud method from the 'rgenoud' package. The opt.methods can be combined to tweak the robustness, whereby the starting parameters are passed to each succeeding method, i.e. rep("Nelder", 5) will do 5 successive Nelder-Mead optimisations or c("GA", "Nelder") will pass the starting values from "GA" to "Nelder". If problems arise, "GA" has shown to be very robust (but slow!) in the refinement of starting values. opt.method = c("BFGS", rep("Nelder, 3")) works also quite well... 3) One of the possible methods from nls is then applied with the starting values obtained from 2). This function is to be used at the single run level. Otherwise use pcrbatch or modlist. The output from the optim methods is checked by ensuring all eigenvalues from the hessian are positive, otherwise a notice will occur.

References

Ritz C & Streibig JC. Bioassay analysis using R. J Stat Soft (2005), 12: 1-22.

Examples

Run this code
## simple l4 fit of F1.1 of the 'reps' dataset
pcrfit(reps, 1, 2, l4) 

## same with five-parameter model
## use "GA" method for optim
pcrfit(reps, 1, 2, l5, opt.method = "GA")

## skip 'optim' method and supply
## own starting values
pcrfit(reps, 1, 2, l4, do.optim = FALSE, start = c(-5, -0.05, 11, 16))

Run the code above in your browser using DataLab