[R] nls: "missing value or an infinity" (Error in numericDeriv) and "singular gradient matrix"Error in nlsModel

Daniela Salvini dsa at life.ku.dk
Tue Feb 13 22:09:14 CET 2007


Hi,

I am a non-expert user of R. I am essaying the fit of two different functions to my data, but I receive two different error messages. I suppose I have two different problems here... But, of which nature? In the first instance I did try with some different starting values for the parameters, but without success. 
If anyone could suggest a sensible way to proceed to solve these I would be really thankful! 

Daniela

*******

Details on data and formulas:

>  polcurve=read.table("polcurve.txt",header=TRUE)
> polcurve
   dist        fath
1     1 0.138908965
2     2 0.113768871
3     3 0.114361753
4     4 0.051065765
5     5 0.095787946
6     6 0.123601131
7     7 0.117340746
8     8 0.054049434
9     9 0.112000962
10   10 0.074843028
11   11 0.064735196
12   12 0.098210497
13   13 0.093786895
14   14 0.033752379
15   15 0.038961039
16   16 0.023048216
17   17 0.010018243
18   18 0.007177034
19   19 0.003787879
20   20 0.000000000
21   21 0.000000000

#Exponential power function
> s=nls(fath~((b^2)/(a^2))*exp((-dist/a)^b),polcurve)


Error in numericDeriv(form[[3]], names(ind), env) : 
        Missing value or an infinity produced when evaluating the model
In addition: Warning message:
No starting values specified for some parameters.
Intializing 'b', 'a' to '1.'.
Consider specifying 'start' or using a selfStart model in: nls(fath ~ ((b^2)/(a^2)) * exp((-dist/a)^b), polcurve) 

#Geometric function
>s=nls(fath~((b-1)*(b-2)/a)*((1+dist/a)^-b),polcurve)


Error in nlsModel(formula, mf, start, wts) : 
        singular gradient matrix at initial parameter estimates
In addition: Warning message:
No starting values specified for some parameters.
Intializing 'b', 'a' to '1.'.
Consider specifying 'start' or using a selfStart model in: nls(fath ~ ((b - 1) * (b - 2)/a) * ((1 + dist/a)^-b),  

Daniela Salvini 
Ph.D. student
University of Copenhagen, 
Faculty of Life Sciences, 
Centre for Forest and Landscape
Hørsholm Kongevej 11
2970 Hørsholm, Denmark
 
e-mail: dsa at life.ku.dk 
Tel.: (+45)35281639 / 35281645
Fax.: (+45)35281517



More information about the R-help mailing list