[R] plotting the result of a nonlinear regression
    lauramorgana at bluewin.ch 
    lauramorgana at bluewin.ch
       
    Tue Feb 10 17:06:18 CET 2009
    
    
  
Hello,
to plot the result of a singular non linear regression (using nls) I usually use the function plotfit, for example:
r.PTG.V<-nls(PTG.P~ fz1(Portata, a,b), data=dati, start=list(a=10, b=10), nls.control(maxiter=200), algorithm='port', 
trace=TRUE, na.action=na.omit, lower=list(a=0, b=10), upper=list(a=100, b=100))
plotfit(r.PTG.V)
I tried to use the function plotfit on the result of the following for loop but I got an error message:
for (i in 1:length(formList))
{
    resultList[[i]] <- nls(formList[[i]], data=subset(dati, Fiume=="Laveggio"), start=startList7[[i]], 
    nls.control(maxiter=1000, warnOnly=TRUE), algorithm='port', na.action=na.omit,lower=lowerList7[[i]], 
    upper=upperList7[[i]])
}
plotfit(resultList[[1]]
"Error in diff(as.numeric(y[ord])) : 
  (list) object cannot be coerced to type 'double'"
Could somebody tell me what this error means? how can I fix this problem? 
Any suggestion appreciated!!
Thanks,
Laura
    
    
More information about the R-help
mailing list