Re: [R] Predicting from an nls model

From: Ben Bolker <bolker_at_ufl.edu>
Date: Thu, 12 Jun 2008 12:59:54 +0000 (UTC)

Ranney, Steven <steven.ranney <at> montana.edu> writes:                                                  

> plot(Weight~Length, data = wae, pch=19,
> xlab="Length (mm)", ylab="Weight (g)",
> xlim = c(150,1000), ylim = c(0, 10050))

          

> mod = seq(150, 1000)

> lines(mod, predict(pow, list(Weight = mod)))
>
> The error I get after I submit the final line is:
>
> Error in xy.coords(x, y) : 'x' and 'y' lengths differ

   Don't you need to specify Length (predictor variable) rather than Weight (response variable) to predict() in this case?

  Ben Bolker



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. Received on Thu 12 Jun 2008 - 14:44:58 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 12 Jun 2008 - 15:00:45 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive