Skip to content
Prev 77416 / 398502 Next

plot spaghetti data

To elaborate a bit on Harold's reply, the use of a "spaghetti plot"
for more than 4 or 5 groups is not recommended.  Consider the
longitudinal data "sleepstudy" in the Matrix package.  A spaghetti
plot can be produced by
Now compare this to the result of
which is a lattice plot with the data for each subject in a separate
panel.  Even better is to use
+        index.cond = function(x, y) coef(lm(y ~ x))[1])

where the panels are ordered according to a characteristic of the data
(the intercept for the per-subject regression line) rather than in the
more-or-less random order created by the subject number.


library(lattice)
xyplot(Reaction ~ Days
On 9/16/05, Doran, Harold <HDoran at air.org> wrote: