Re: [R] lines() warning message

From: Peter Dalgaard <p.dalgaard_at_biostat.ku.dk>
Date: Thu, 03 Jul 2008 23:07:43 +0200

Ranney, Steven wrote:
> I have data that looks like
>
> Year,Recruit,Spawner,Mtempcv
> 1958,4532,775,0.24125
> 1959,22996,2310,0.16319
> 1960,628,2990,0.46056
> 1961,879,1400,0.33028
> 1962,14747,1130,0.22618
> 1963,13205,790,0.20596
> 1964,31793,1195,0.19229
> 1965,10621,981,0.20363
> 1966,22271,870,0.3452
> 1967,8736,1104,0.27511
> 1968,8761,883,0.10884
> 1969,18885,1421,0.17799
> 1970,10098,1198,0.2106
> 1971,3394,760,0.22098
> 1972,1697,1354,0.39461
> 1973,25159,1308,0.19696
> [truncated]
>
> with program
>
> #Ricker Curve
> mod2=nls(Recruit~(Spawner*exp((delta+echo*Spawner)+(foxtrot*Mtempcv))), data=box48,
> start=list(delta=4, echo=0, foxtrot=-7), trace=TRUE)
> plot(Recruit~Spawner, data=box48, pch=19)
> mod2a=seq(369, 3000)
> lines(mod2a, predict(mod2, list(Spawner=mod2a)), col="red", lty=2)
>
> R has no problem finding a solution to the nls() model (only 7 iterations are needed), but when I try to plot the line on the requested plot, I get the warning message "Warning message:
> In (delta + echo * Spawner) + (foxtrot * Mtempcv) :
> longer object length is not a multiple of shorter object length."
>
> R tries to plot the line, but it appears as just a mess of vertical lines that get more dense where (I would imagine) the actual line is to go. Any ideas what may be causing this issue?
>
>
Hmm,,, The predict() call looks dodgy. The model depends on Spawner AND Mtempcv, but you're only giving the former in the newdata= part. So a good guess that one of them is recycled to the length of the other.

-- 
   O__  ---- Peter Dalgaard             ุster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard_at_biostat.ku.dk)              FAX: (+45) 35327907

______________________________________________
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 03 Jul 2008 - 21:10:22 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 03 Jul 2008 - 22:31:22 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