Dear R-Help, I am using R2.3.0, nlme library on Windows XP. I created a grouped data object with y, subject, group and time variables. I can plot the data using plot.nfnGroupedData(form=y~time|subject,outer=~group) This gives me individual curves (connected points) for each subject in separate panels for each group. I would also like to add to the plot a curve with the mean y at each time point for each group. how can I do that? Thanks -- Osman O. Al-Radi, MD, MSc, FRCSC Fellow, Cardiovascular Surgery The Hospital for Sick Children University of Toronto, Canada -- Osman O. Al-Radi, MD, MSc, FRCSC Fellow, Cardiovascular Surgery The Hospital for Sick Children University of Toronto, Canada
On 5/1/06, Osman Al-Radi <osman.al.radi at gmail.com> wrote:> Dear R-Help, > > I am using R2.3.0, nlme library on Windows XP. > > I created a grouped data object with y, subject, group and time variables. > > I can plot the data using > > plot.nfnGroupedData(form=y~time|subject,outer=~group) > > This gives me individual curves (connected points) for each subject in > separate panels for each group. > > I would also like to add to the plot a curve with the mean y at each time > point for each group. how can I do that?Reproducible example please. Deepayan
My apologies: library(nlme) gd<-groupedData(y~time|subject,outer=~group) plot(gd, outer=T) this produces a pannel per group with a curve per subject I need in addition to that the mean (or lowess) y in each panel. thanks osman On 5/1/06, Deepayan Sarkar <deepayan.sarkar at gmail.com> wrote:> On 5/1/06, Osman Al-Radi <osman.al.radi at gmail.com> wrote: > > Dear R-Help, > > > > I am using R2.3.0, nlme library on Windows XP. > > > > I created a grouped data object with y, subject, group and time variables. > > > > I can plot the data using > > > > plot.nfnGroupedData(form=y~time|subject,outer=~group) > > > > This gives me individual curves (connected points) for each subject in > > separate panels for each group. > > > > I would also like to add to the plot a curve with the mean y at each time > > point for each group. how can I do that? > > Reproducible example please. > > Deepayan >
On 5/1/06, Osman Al-Radi <osman.al.radi at gmail.com> wrote:> My apologies: > > library(nlme) > gd<-groupedData(y~time|subject,outer=~group) > plot(gd, outer=T) > > this produces a pannel per group with a curve per subjectFor me, it produces the following:> library(nlme) > gd<-groupedData(y~time|subject,outer=~group)Error in data.frame(y = y, time = time, subject = subject, group = group) : object "y" not found so your example is not reproducible :-) Feel free to use a dataset from nlme or any other standard package, or even simulated data, but please give something that we can run. Deepayan