Re: [R] Question about data used to fit the mixed model

From: Doran, Harold <HDoran_at_air.org>
Date: Sun 30 Jul 2006 - 22:27:31 EST

You can have one observation per subject with multiple subjects nested in a group. If you only have 1 observation per group, then there is no multilevel structure to your data.

For example, 30 students in a classroom or 20 employees in an office division are appropriate data structures. On the other hand 1 observation per school in each of 30 schools has no grouping structure.

If you look at some of the data in the mlmRev package or other data files in the nlme package and look at their structure, this might be helpful to see exactly how the data might be layed out.

Look at the egsingle or the star data in the mlmRev package to see examples of longitudinal models where eac student has multiple test scores. In egsingle, each student is properly nested in a single school whereas in the star data, students are crossed with teachers and schools.

Use the str(star) to see the data structure. Or, you can do something like head(star) to see the 1st 6 rows and see how the data are layed out.

I hope this helps,
Harold

-----Original Message-----
From: r-help-bounces@stat.math.ethz.ch on behalf of Nantachai Kantanantha Sent: Sun 7/30/2006 12:33 AM
To: r-help@stat.math.ethz.ch
Subject: [R] Question about data used to fit the mixed model  

Hi everyone,

I would like to ask a question regarding to the data used to fit the mixed model.

I wonder that, for the response variable data used to fit the mixed model
(either via "spm" or "lme"), we must have several observations per subject
(i.e. Yij, i = 1,..,M, j = 1,.., ni) or it can be just one observation per
subject (i.e. Yi, i = 1,...,M). Since we have to specify the groups for random effect components, if we have only one observation per subject, then each group will have only one observation.

Thank you vert much for your help.
Sincerely yours,

Nantachai



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

        [[alternative HTML version deleted]]



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Sun Jul 30 22:36:15 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Mon 31 Jul 2006 - 02:16:40 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.