# Start function issues using nls

I want to statistically compare two curve fitting from two different dataset : pA3 et pE5. They both follow sigmoid curves (I do not use high enough concentration of pA3 to see the lower plateau). So I did sigmoid curve fitting using SSlogis function. You can have a look on my data : sig <- do ~ SSlogis(log(concentration), Asym, xmid, scal)
pA3 <- nls(sig, bilan, subset = peptide == "A3")
pE5 <- nls(sig, bilan, subset = peptide == "E5")



If I run pA3 and pE5, it is working and I can have my parameter estimates

> pA3
Nonlinear regression model
model: do ~ SSlogis(log(concentration), Asym, xmid, scal)
data: bilan
Asym   xmid   scal
1.680  2.808 -1.201
residual sum-of-squares: 4.634

Number of iterations to convergence: 0
Achieved convergence tolerance: 8.13e-06

> pE5
Nonlinear regression model
model: do ~ SSlogis(log(concentration), Asym, xmid, scal)
data: bilan
Asym   xmid   scal
1.458 -1.185 -1.059
residual sum-of-squares: 4.362

Number of iterations to convergence: 0
Achieved convergence tolerance: 4.123e-06



Now I want to know if my two fitting are statistically different. I found this case which has a similar question to mine stackexchange_curve_fitting. So I ran the code and I have got this error message :

> A3+E5 <- nls(do ~ SSlogis(log(concentration), Asym[peptide], xmid[peptide], scal[peptide]),
+            transform(bilan, peptide = as.character(peptide)),
+            subset = peptide %in% c("A3","E5"),
+            start = as.data.frame(rbind(coef(pA3), coef(pE5))))
Error in numericDeriv(form[[3L]], names(ind), env) :
Missing value or an infinity produced when evaluating model

#Start values
> as.data.frame(rbind(coef(pA3), coef(pE5)))
Asym      xmid      scal
1 1.680023  2.808046 -1.201244
2 1.457737 -1.184576 -1.059212


Based on my research start_function, it seems that it is corresponding to an error with the start function, but I didn't manage to resolve it. Since my start values correspond to my parameter estimates gave by nls, I think they are good start values. Anyway I changed the start with other values but it still doesn't work.

• No idea, sorry, as I am not even a routine R user, but an incidental detail is that your plotted curves presumably come out of something like a spline function that unsurprisingly doesn't know that your curves are logistic, so there are spurious turning points shown whereas each curve should be monotone decreasing. There must also be a way in R to get ${\mu}$M instead of the barbaric uM. (And the $\mu$ should be upright too.) – Nick Cox Dec 11 '20 at 10:23