[R] Predicting from an nls model

Ben Bolker bolker at ufl.edu
Thu Jun 12 14:59:54 CEST 2008


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



More information about the R-help mailing list