# How to set up the initial data in the nls model

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 +  :


or

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: Best regards

• 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. – Roland Sep 3 '14 at 14:49
• added the formula. the brute-force approach? sth more about that? – Legionista Sep 4 '14 at 7:53
• Well, you define a grid and each grid point is used as starting values. Look at the package documentation. – Roland Sep 4 '14 at 7:55
• I am struggling at this moment and I guess I got the idea but I cannot make it to work – Legionista Sep 4 '14 at 8:04
• 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 – Legionista Sep 4 '14 at 8:05