[R] Error "singular gradient matrix at initial parameter estimates" in nls

Corrado ct529 at york.ac.uk
Wed Mar 31 15:13:18 CEST 2010


Dear JN, Bert,

1) It is not a perfect fit. I do not think I have ever said that. I said 
that an external algorithms fits the model without any problems: with ~ 
500,000 data points and 19 paramters (ki in the original equation), it 
fits the model in less than 1 second. The data are not artificial data. 
The variables are independent (pi in the original model). The solution 
is unique and the rapidity of convergence is practically independent 
from the selection of start conditions (with a reasonable selection of 
start conditions at least). The resulting residuals are approximately 
normally distributed with mean 0 and sd ~ 4.23.

2) I agree with the comment of Bert on over-parametrization, but again 
the model is not overparamterised, and it is identifiable (in part 
answered already in (1))

Regards


Prof. John C Nash wrote:
> If you have a perfect fit, you have zero residuals. But in the nls 
> manual page we have:
>
>> Warning:
>>
>>      *Do not use ‘nls’ on artificial "zero-residual" data.*
>
> So this is a case of complaining that your diesel car is broken 
> because you ignored the "Diesel fuel only" sign on the filler cap and 
> put in gasoline.
>
> However I've not been happy with this choice in the code of nls -- 
> it's been there a long time -- and my own codes from 1974 onwards have 
> always handled zero residual cases. I do believe that the code could 
> at least give a better diagnostic message. Zero residuals -- perfect 
> fits -- arise when one is interested more or less in an interpolating 
> function rather than doing statistics, and I can understand the 
> reluctance of statisticians to countenance such a use of nls.
>
> And Bert's comment on overparametrization is almost certainly valid also.
>
> JN
>


-- 
Corrado Topi
PhD Researcher
Global Climate Change and Biodiversity
Area 18,Department of Biology
University of York, York, YO10 5YW, UK
Phone: + 44 (0) 1904 328645, E-mail: ct529 at york.ac.uk



More information about the R-help mailing list