Douglas Bates (
28 May 1998 07:38:45 -0500

Bircan Erbas <> writes:

> I have a data set which consists of the following:
> 50 Subjects
> 2 treatments: Control and 5gInsulin
> 5 measurements are taken on each subject at 0, 24, 48, 72, and 96 hours.
> I am interested in the within subject differences, treatment differences
> and significant differences within the time intervals, in particular at
> what time does this difference occur?.
> Can I do this in Splus?. I have Splus version 3.3 for windows.

The current test version of the lme function in the nlme library
can display and fit linear mixed-effects models to such data. These
models can include the traditional "repeated measures analysis" models
and several others.

After you install the library you could begin by creating a
groupedData object for the data and plotting the response versus time
by subject. I'm not sure from your description if this is a
cross-over design or not. If each subject received only one treatment
then you would designate the treatment as an outer factor to subject.
If each subject received both treatments and you have two curves per
subject then you would designate the treatment as inner with respect
to subject. The creation of the groupedData object would look
something like
mydat <- groupedData( response ~ Time | Subject,
data = read.table("mydat.dat", header = TRUE),
outer = ~ Treatment)
where the columns in the data file are labelled "response", "Time",
"Subject", and "Treatment".

Then plot(mydat) will produce a trellis plot of the data. From there
you can go on to fit models as shown in the User's Guide.

This approach allows you to contrast the time courses under the
different treatments. A traditional repeated measures analysis
essentially treats the times as being an unordered factor which loses
a lot of information about the design.

Let me know if you want more details.

Douglas Bates                  
Statistics Department                    608/262-2598
University of Wisconsin - Madison