Skip to content

How do I add fitted curves to coplots?

2 messages · John S. Walker, Brian Ripley

#
G'day

I've been performing an analysis of some data by a follow the leader
method (Bad I know but it seems to work and I think I understand all the
steps now) and I've run into a problem. The analysis is for all practical
purposes identical to the non-linear mixed effects analysis performed on
Ludbrooks Rabbit data in the second edition of Venables & Ripley (page
315--321). I have the stats pretty much done and have estimates for all
the model parameters from the nlme object.  Now I want to add the fitted
lines to my coplot of the data in the manner of figure 10.3.  How would I
do this? I owuld guess that I use the lines function or the panel function
but I can't find an index varibale to tell me what panel I'm in. Any
suggestions?


John Walker




-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
On Tue, 16 May 2000, John S. Walker wrote:

            
You need to fake it. There is an example in the 3rd edition R scripts,
which for the Rabbit data becomes

coplot(seq(0,40, len=60) ~ log(Dose) | Animal * Treatment, Rabbit,
       show.given=FALSE,
       panel = function(x, y, ...) {
           ind <- round(1 + 59*y/40)
           lines(spline(x, fitted(R.nlme2)[ind]))
           points(x, Rabbit$BPchange[ind])
       })

coplot does not have the subscripts = T argument that Trellis has.
I think we could usefully add it (since `lattice' seems nowhere visible
yet), and I will do so for 1.1.0.  Also, the handling of xlab/ylab differs
a bit from the S original, and I will take a look.