[R] plotting the result of a nonlinear regression

stephen sefick ssefick at gmail.com
Tue Feb 10 18:15:19 CET 2009


?predict

On Tue, Feb 10, 2009 at 11:06 AM, lauramorgana at bluewin.ch
<lauramorgana at bluewin.ch> wrote:
> 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
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Stephen Sefick

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods.  We are mammals, and have not exhausted the
annoying little problems of being mammals.

								-K. Mullis




More information about the R-help mailing list