1 Jul 01:14 2011

### Re: Error "singular gradient matrix at initial parameter estimates" in nls

Walmes Zeviani <walmeszeviani <at> gmail.com>

2011-06-30 23:14:03 GMT

2011-06-30 23:14:03 GMT

I think that these aren't good initial values. If you do a plot of data and add a curve, the curve don't approximate the data. Frequently I use interactive procedures to get good initial values. Using playwith() you can handle sliders to adjust values and use in nls(), look the following r <- c(1.16,1.143,1.109,1.093,1.079,1.066,1.053,1.040,1.027,1.015,1.004,0.994,0.985,0.977) D <- c(0.1806551,0.2703113,0.3757225,0.5271811,0.8665835,1.0812568,1.0612762,1.0726612, 1.167927,1.191092,1.1336938,1.1215107,0.9619603,0.8315467) names <- c(La,Ce,Pr,Nd,Sm,Eu,Gd,Tb,Dy,Ho,Er,Tm,Yb,Lu) plot(log(D)~r) Do <- 0.8; En <- 390; ro <- 1.03 curve(log10(Do)*exp(((-4*pi*En*Na)*((ro/2)*(x-ro)^2+(1/3)*(x-ro)^3))/(R*T)), add=TRUE) Na <- 6.0221415*10^23 # Avrogadro's number T <- 1010 # Temp in K R <- 8.3144 # Gas constant [J mol^-1 K^-1] ## 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) require(playwith) start <- list() playwith((Continue reading)