I am struggling with nls model given below. I have a blur idea how to set up the initial values in it. Shall I use "try and error" method or is there any other way to make it more systematic.

> model3<-nls(H2~H1*(A2^b1*(A1^b1*(b3+H1+sqrt((b3+H1)^2+2*H1*exp(b2)/A1^b1))+exp(b2))/
+ A1^b1*(A2^b1*(b3+H1+sqrt((b3+H1)^2+2*H1*exp(b2)/A1^b1))+exp(b2))), start=c(b1=0.1, b2=2, b3=1), trace=T)

I get response

Error in nls(H2 ~ H1 * (A2^b1 * (A1^b1 * (b3 + H1 + sqrt((b3 + H1)^2 +  : 
  singular gradient


Error in nls(H2 ~ H1 * (A2^b1 * (A1^b1 * (b3 + H1 + sqrt((b3 + H1)^2 +  : 
  step factor 0.000488281 reduced below 'minFactor' of 0.000976562

depending on what values of parameters I use.

Models formula look like this:

enter image description here

Best regards

  • $\begingroup$ That's some complicated function. Can you show it as a formula? You could always use the brute-force approach for finding starting values as implemented in package nls2. $\endgroup$ – Roland Sep 3 '14 at 14:49
  • $\begingroup$ added the formula. the brute-force approach? sth more about that? $\endgroup$ – Legionista Sep 4 '14 at 7:53
  • $\begingroup$ Well, you define a grid and each grid point is used as starting values. Look at the package documentation. $\endgroup$ – Roland Sep 4 '14 at 7:55
  • $\begingroup$ I am struggling at this moment and I guess I got the idea but I cannot make it to work $\endgroup$ – Legionista Sep 4 '14 at 8:04
  • $\begingroup$ I recieve that and have no clue how to solve it out Error in numericDeriv(form[[3L]], names(ind), env) : Missing value or an infinity produced when evaluating the model In addition: There were 28 warnings (use warnings() to see them) Error in result[[which.min(ss)]] : attempt to select less than one element $\endgroup$ – Legionista Sep 4 '14 at 8:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.