[R] Problem with 'nls' fitting logistic model (5PL)
Bert Gunter
gunter.berton at gene.com
Wed May 2 21:47:41 CEST 2012
Plot the data. You're clearly overfitting.
(If you don't know what this means or why it causes the problems you
see, try a statistical help list or consult your local statistician).
-- Bert
On Wed, May 2, 2012 at 12:32 PM, Michal Figurski
<figurski at mail.med.upenn.edu> wrote:
> Dear R-Helpers,
>
> I'm working with immunoassay data and 5PL logistic model. I wanted to
> experiment with different forms of weighting and parameter selection, which
> is not possible in instrument software, so I turned to R.
>
> I am using R 2.14.2 under Win7 64bit, and the 'nls' library to fit the model
> - I started with the same model and weighting type (1/y) as in the
> instrument to see if I'll get similar results. However, in some instances I
> don't get any results - just errors.
>
> Here is an example calibration data, representative of my experiment.
> Instrument soft had no problem fitting it:
> x <- structure(list(SPL = structure(c(1L, 1L, 2L, 2L, 3L, 3L, 4L,
> 4L, 5L, 5L, 6L, 6L, 7L, 7L), .Label = c("St1", "St2", "St3",
> "St4", "St5", "St6", "St7"), class = "factor"), MFI = c(10755.5,
> 9839, 5142.5, 4857, 1510.5, 1505, 502.5, 451, 215, 195.5, 58,
> 57, 15, 15), nom = c(206, 206, 125, 125, 68, 68, 38, 38, 24,
> 24, 13, 13, 6.5, 6.5), weights = c(0.0013946353028683, 0.00152454517735542,
> 0.00291686922702965, 0.00308832612723904, 0.0099304865938431,
> 0.00996677740863787, 0.0298507462686567, 0.0332594235033259,
> 0.0697674418604651, 0.0767263427109974, 0.258620689655172,
> 0.263157894736842,
> 1, 1)), .Names = c("SPL", "MFI", "nom", "weights"), row.names = c(NA,
> -14L), class = "data.frame")
>
> And here is the nls fit:
> fit <- nls(MFI~a + b/((1+(nom/c)^d)^f), data=x, weights=x$weights,
> start=c(a=100, b=10000, c=100, d=-1, f=1))
>
> I've tried every possible combination of starting values, including the
> values fitted by the instrument soft - to no avail. I've probably seen all
> possible error messages from 'nls' trying to fit this.
>
> If anyone has an idea why it's not working - let me know.
>
> Best regards,
>
> --
> Michal J. Figurski, PhD
> HUP, Pathology & Laboratory Medicine
> Biomarker Research Laboratory
> 3400 Spruce St. 7 Maloney S
> Philadelphia, PA 19104
> tel. (215) 662-3413
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
--
Bert Gunter
Genentech Nonclinical Biostatistics
Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm
More information about the R-help
mailing list