Stewart Schultz <schultz at fig.cox.miami.edu> writes:
> How would I plot several (24) fitted curves (nonlinear least squares)
> within a single plot?
Are you sure you want to do that? Overlaying 24 curves on a single
plot tends to make for a busy plot. You may want to consider a
trellis type of plot instead. See xyplot from the lattice package.
> To get the parameters I use:
>
> resff <- list()
> for (s in levels(PairID)) {
> resff[[s]] <- nls(Photo ~ SSasymp(Ci, Asym, lrc, c0),
> subset = (PairID == s))
> }
An alternative would be to use the nlsList function from the nlme
package.
If you really do want to plot all the fitted nls models on a single
plot, it is best to use predict on the fitted model with a closely
spaced set of Ci values that cover the range of the observed data. It
could look like
plot(Ci, Photo, type = "n") # sets up the plotting scales
crange <- range(Ci)
cseq <- seq(crange[1], crange[2], len = 100)
for (s in levels(PairID)) {
lines(cseq, predict(resff[[s]], list(Ci = cseq)))
}
> Is it also possible to plot two different groups (male, female) of curves
> in the same plot, with different style lines?
Yes.
>From your questions it seems that you may want to consider some of the
techniques available in the nlme package. The book
@Book{pinh:bate:2000,
author = {Jos\'{e} C. Pinheiro and Douglas M. Bates},
title = {Mixed-Effects Models in \textsf{S} and \textsf{S-PLUS}},
publisher = {Springer},
year = 2000,
series = {Statistics and Computing}
}
has several examples of these techniques.
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at
stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._