This is my first post, so I hope that I include everything correctly and thank you for any help that you may be able to give.
I am trying to fit a curve, to a set of raw data which I have collected. The data is sigmoid and should be explained by a Shae-Ackers model (commonly used in biology). I initially tried to do this using the 'nls' function, after looking over other examples on this site. However I received the following error:
"error:singular gradient matrix at initial parameter estimates".
Subsequently, I tried to use the 'nlsLM' function. As I understand from other questions on this site, this should use an alternative algorithm to fit my model which avoids the error. However, I still get the same error:
"error:singular gradient matrix at initial parameter estimates".
Here is the code which I am currently trying to get to work:
library("minpack.lm")
library("nls2")
L = c(0, 0.0001, 0.0005, 0.001, 0.005,
0.01, 0.05, 0.1, 0.5, 1, 5, 10, 50) # X- values, inducer concentration.
Fluo = c(23.10263117,
21.5111054,
25.01080225,
32.63906667,
82.6671047,
287.1788694,
812.2339928,
1308.71973,
2822.260637,
3675.085354,
4634,
4399.131349,
4096.759224) # Y-values, fluorescence measurement.
model <- nlsLM(Fluo ~ Fmax*((k1 + k3C0*((L^n)/(kd^n + L^n)))/(1 + k1 + k2C0*((L^n)/(kd^n + L^n)) + k3C0*((L^n)/(kd^n + L^n)))),
start = c(k1 = 0.009,k2C0 = 37.5,k3C0 = 3.4,kd = 0.09,n = 2.8,Fmax = 7650), algorithm = "LM", trace = TRUE)
plot(log10(L), log10(Fluo), main = "data")
lines(log10(L), log10(fitted(model)), col = "red", lty = 2)
The starting estimates which I have provided should be very close to the values I am looking for, as these have been previously reported in literature for the system I am trying to fit.
So my overall questions are this:
1. Is there a way that I can find alternative starting estimates which will avoid this error?
2. Which other functions other than 'nls' or 'nlsLM' may I be able to use to fit my model? (I have also looked at 'nls.lm' but am unsure how to implement this correctly).
Thank you very much for any help and I would be happy to provide any other information if needed!