[R] Error "singular gradient matrix at initial parameter estimates" in nls
Peter Ehlers
ehlers at ucalgary.ca
Thu Jun 30 21:42:51 CEST 2011
On 2011-06-30 06:14, Niklaus Hurlimann wrote:
> Greetings,
>
> I am struggling a bit with a non-linear regression. The problem is
> described below with the known values r and D inidcated.
> I tried to alter the start values but get always following error
> message:
>
> Error in nlsModel(formula, mf, start, wts):
> singular gradient matrix at initial parameter estimates
> Calls: nls -> switch -> nlsModel
>
> I might be missing something with regard to the different algorithms or
> I just have to try again with some different start values. If anyone
> finds some time to have a look at that, any advice would be very much
> appreciated.
I don't know anything about a Brice-Model, but I doubt that you have
it right. 4*pi*390*Na is about 3*10^27 and that doesn't seem right
to me.
In addition, do put your data into a data.frame (containing
variables r and D) and learn to use dput for posting data.
Peter Ehlers
>
>
> ##Brice-Model
> bricemod<-nls(log10(D) ~ log10(Do)*exp(((-4*pi*En*Na)*((ro/2)*(r-ro)^2
> +(1/3)*(r-ro)^3))/(R*T)), start=list(Do=0.8, En=390,
> ro=1.03),trace=TRUE)
>
> Na<-6.0221415*10^23 # Avrogadro's number
> T<-1010 # Temp in K
> R<-8.3144 #Gas constant [J mol^-1 K^-1]
>
> r<-data.matrix(PRr[c("r")])
> r
> La 1.160
> Ce 1.143
> Pr 1.109
> Nd 1.093
> Sm1.079
> Eu 1.066
> Gd 1.053
> Tb 1.040
> Dy 1.027
> Ho 1.015
> Er 1.004
> Tm 0.994
> Yb 0.985
> Lu 0.977
>
>
> D<-data.matrix(PRr[c("D")])
> D
> La 0.1806551
> Ce 0.2703113
> Pr 0.3757225
> Nd 0.5271811
> Sm 0.8665835
> Eu 1.0812568
> Gd 1.0612762
> Tb 1.0726612
> Dy 1.1679270
> Ho 1.1910920
> Er 1.1336938
> Tm 1.1215107
> Yb 0.9619603
> Lu 0.8315467
>
>
> Niklaus
>
More information about the R-help
mailing list