# How do I resolve 'Error singular gradient matrix at initial parameter estimates' in R

#### Rafael007

##### New Member
Hello everyone,

I am a PhD student and an intermediate in R. I work on metal (copper and zinc) mixtures toxicity in algae.

I need help from anyone that use the models - concentration addition (CA) and independent action (IA) for assessing toxicity of mixtures of contaminants in R.

I just concluded a mixture toxicity experiment and I'm trying to fit my observed experimental data to both models (CA and IA) to determine which of the two models bests explains my data. I am using the nlsModel in R but I get this error:

Error in nlsModel(formula, mf, start, wts) : singular gradient matrix at initial parameter estimates.

Does anyone know how to resolve this? I have attached a file with my code and data. (STEP 2 IN THE ATTACHED FILE)

Rafael.

#### consuli

##### Member
Re: How do I resolve 'Error singular gradient matrix at initial parameter estimates'

The problem results from
Code:
nls(res ~  1/(1 + (conc1/exp(-a4/b4) + conc2/exp(-a5/b4))^b4 ),
+ data=Mixture, start=list(a4=a1, a5=a2, b4=b3), trace=TRUE)
Somewhere in the iteration R needs to invert a gradient matrix, which is not invertable (aka singular).

Does anyone know how to resolve this?
Try to print out R's internal calculations. If not possible, reprogram the nls solution manually yourself, to reproduce the error.

Last edited: