nls
,
with sensible starting parameters obtained from either nls.lm
(default), newuoa
or optim
.pcrfit(data, cyc = 1, fluo, model = l4, do.optim = TRUE,
opt.method = "all", nls.method = "all",
start = NULL, robust = FALSE, control = nls.control(),
weights = NULL, verbose = TRUE, ...)
FALSE
, refinement of starting values by any of the optimization methods (see 'Details') will be skipped.nls
. See 'Details'.TRUE
, robust nonlinear regression is used. See 'Details'.nls
or qpcR:::rnls
.data
containing the weights for the nonlinear fit.TRUE
, fitting and convergence results will be displayed in the console.optim
, genoud
or nls
.pcrfit
.opt.method
.model$ssfct
.
2) Starting values are refined by any of the methods available in optim
, the derivative-free quadratic minimization newuoa
from package 'minqa' or the Levenberg-Marquardt algorithm (nls.lm
).
The default setting is all
, meaning that the optimization is done in the order "LM", "BFGS", "Nelder-Mead", "minqa" and "SANN".
If any of the methods successfully converged, the remaining are skipped and the refined starting values transferred to nls
.
The opt.method
s 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("LM", "Nelder") will pass the starting
values from "LM" to "Nelder". Levenberg-Marquardt ("LM") is very fast and reliable in many scenarios and is thus the default first method.
3) The refined starting values from 2) are fitted with nls
using the order "port", "default" (Gauss-Newton) and "plinear".
Again, if any of the methods converged, the remaining are skipped.
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 and the next method in queue is used.
If robust = TRUE
, robust nonlinear fitting will be used. To do this, the internal function qpcR:::rnls
is called
which is a modification of the nlrob
function of the 'robustbase' package. Modifications were done such that all available generic functions
for objects of class 'nls' can be used on the output of qpcR:::rnls
, such as predict
, confint
etc.## simple l4 fit of F1.1 of the 'reps' dataset
pcrfit(reps, 1, 2, l4)
## using BFGS and Nelder from 'optim'
pcrfit(reps, 1, 2, l5, opt.method = c("BFGS", "Nelder-Mead"))
## skip 'optim' method and supply
## own starting values
pcrfit(reps, 1, 2, l4, do.optim = FALSE, start = c(-5, -0.05, 11, 16))
## make a robust model
pcrfit(reps, 1, 2, l4, robust = TRUE)
Run the code above in your browser using DataLab