I have a data set in which $y$ is roughly related to $\log(x)$. Now I wish to fit the curve $$y=A(1-\exp(BX))$$
When I use R and the
nls2 function, then I encounter the error
SINGULAR MATRIX at initial parameters.
I have tried to use a model with the $a$ parameter fixed, in which case it works fine
model2<-nls2(ynew~1000*(1-exp(bx)),data=sData,start = list(b=0.08),trace = TRUE,control = list(maxiter=1000))
But when I have both $a$ and $b$ as free parameters then I get the error
model1<-nls2(ynew~A*(1-exp(bx)),data=sData,start = list(A=10,b=0.08),trace = TRUE,control = list(maxiter=1000))
Some similar issue is explained in this thread R nls singular gradient where they suggest to:
- linearize to get better starting values
- in addition use the
How can I linearize my function? I can not rewrite into a linear function by taking the logarithm.
Below is an image of my function/data. I will try to post the subset of the data