[R] Problem with 'nls' fitting logistic model (5PL)

Gabor Grothendieck ggrothendieck at gmail.com
Thu May 3 20:32:42 CEST 2012


On Wed, May 2, 2012 at 3: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))
>

This looks quite linear to me:

fo <- log(MFI) ~ log(nom)
plot(fo, x)
abline(lm(fo, x))

Try using that as the basis for an alternate model.

-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com



More information about the R-help mailing list