[R] different forms of nls recommendations

emorway emorway at engr.colostate.edu
Sat Mar 20 23:55:16 CET 2010


Hello, 

Using this data:
http://n4.nabble.com/file/n1676330/US_Final_Values.txt US_Final_Values.txt 

and the following code i got the image at the end of this message:

US.final.values<-read.table("c:/tmp/US_Final_Values.txt",header=T,sep=" ")
US.nls.1<-nls(US.final.values$ECe~a*US.final.values$WTD^b+c,data=US.final.values,start=list(a=2.75,b=-0.95,c=0.731),trace=TRUE)
f.US1<-function(x){coef(US.nls.1)["a"]*x^coef(US.nls.1)["b"]+coef(US.nls.1)["c"]}
xvals.US1<-seq(min(US.final.values$WTD),max(US.final.values$WTD),length.out=75)
yvals.US1<-f.US1(xvals.US1)
Rsq.nls.1<-sum((predict(US.nls.1)-mean(US.final.values$ECe))^2/sum((US.final.values$ECe-mean(US.final.values$ECe))^2))
plot(US.final.values$WTD,US.final.values$ECe,col="red",pch=19,cex=.75)
lines(xvals.US1,yvals.US1,col="blue")

but the r^2 wasn't so hot.  
Rsq.nls.1
[1] 0.2377306

So I wanted to try a different equation of the general form a/(b+c*x^d)

US.nls.2<-nls(US.final.values$ECe~(a/(b+c*US.final.values$WTD^d)),data=US.final.values,start=list(a=100.81,b=73.7299,c=0.0565,d=-6.043),trace=TRUE,algorithm="port")

but that ended with "Convergence failure: false convergence (8)".  I tried
relaxing the convergence criteria to no avail.  Assuming the form of the
equation I'm trying to use is the problem, I've been unable to track down a
source that shows the shapes of various non-linear equations that I might be
able to try as alternatives.  Any suggestions?

http://n4.nabble.com/file/n1676330/nls_image.jpg 

-- 
View this message in context: http://n4.nabble.com/different-forms-of-nls-recommendations-tp1676330p1676330.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list