[R] 'singular gradient matrix’ when using nl s() and how to make the program skip nls( ) and run on

2007-09-06 Thread Yuchen Luo
Dear friends. I use nls() and encounter the following puzzling problem: I have a function f(a,b,c,x), I have a data vector of x and a vectory y of realized value of f. Case1 I tried to estimate c with (a=0.3, b=0.5) fixed: nls(y~f(a,b,c,x), control=list(maxiter = 10, minFactor=0.5

Re: [R] 'singular gradient matrix’ when using nl s() and how to make the program skip nls( ) and run on

2007-09-06 Thread Gabor Grothendieck
In case 1 graph your function and then use optimize rather than nls. In case 2 a and b may have the same effect as c on f whereas they don't vary in case 1 so it does not matter. For example consider minimizing f - function(a, b) (a + b)^2 If a is fixed at zero then the minimum occurs for b=0