Learn R Programming

qpcR (version 1.2-1)

modlist: Create nonlinear models from a dataframe and coerce them into a list

Description

Essential function to create a list of nonlinear models from the columns of a qPCR dataframe. Very handy if following functions should be applied to different qPCR models, i.e. by sapply.

Usage

modlist(x, cyc = 1, fluo = NULL, model = l4, opt = FALSE, norm = FALSE, 
        backsub = NULL, opt.method =  rep("Nelder", 5), nls.method = "port",
        sig.level = 0.05, crit = "ftest", ...)

Arguments

x
a dataframe containing the qPCR data.
cyc
the column containing the cycle data. Defaults to first column.
fluo
the column(s) (runs) to be analyzed. If NULL, all runs will be considered.
model
the model to be used.
opt
logical. Should model selection be applied?
norm
logical. Should the raw data be normalized within [0; 1] before model fitting?
backsub
background subtraction. If NULL, not applied. Otherwise, a numeric sequence such as 1:10. See 'Details' in pcrbatch.
opt.method
see pcrfit.
nls.method
see pcrfit.
sig.level
see mselect.
crit
see mselect.
...
other parameters to be passed to pcrfit or mselect.

Value

  • A list with each item containing the model from each column. A 'names' item containing the column name is attached to each model.

Examples

Run this code
## calculate efficiencies for each run in
## the 'reps' data
## subtract background using the first 8 cycles
ml <- modlist(reps, model = l5, backsub = 1:8)
sapply(ml, function(x) efficiency(x, plot = FALSE)$eff)

## 'crossing points' for the first 3 runs (normalized)
##  and using best model from Akaike weights
ml <- modlist(reps, 1, 2:4, model = l5, opt = TRUE, norm = TRUE, crit = "weights" )
sapply(ml, function(x) efficiency(x, plot = FALSE)$cpD2)

Run the code above in your browser using DataLab