I am trying to estimate parameters for generalized least-squares regression on some community data. I have successfully done this for one set of data, but when I try the same technique to estimate parameters for another group, I get the following error message:
Error in gnls(SF ~ a * Site_Code^b, data = data, weights = varPower(form = ~Site_Code), :
Step halving factor reduced below minimum in NLS step
I have noticed that other people have the same issue. One proposed solution is to set nlsTol to 0.1 instead of 0.001 (the default) using gnlsControl, but when I do this, I have the same issue. My data looks like this:
Site_Code SF
5 3
5 0
5 2
5 0
5 0
5 0
5 2
5 0
5 0
5 0
5 0
5 3
1 0
1 1
1 29
1 15
1 7
1 0
1 10
1 12
1 55
2 0
2 5
2 0
2 0
2 3
2 24
2 49
2 17
2 1
3 4
3 48
3 7
3 1
3 31
3 0
3 0
3 1
4 8
4 16
4 29
4 0
4 1
4 2
4 1
4 7
4 3
7 2
7 0
7 0
7 0
7 0
7 0
7 2
7 1
7 0
7 1
7 0
7 0
8 1
8 2
8 1
8 2
8 0
8 0
8 3
8 0
8 2
6 0
6 6
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 2
6 0
6 3
Worked fine for me; you didn’t give starting values, so I eyeballed some. Maybe you have worse starting values?
Also, it’s not surprising that you’re having trouble here — for the purposes of fitting the mean, you have two parameters and only 4 independent x values … and the same for the variance estimation.
Results:
Plot: