[R-sig-ME] partly crossed design

Douglas Bates bates at stat.wisc.edu
Tue Jul 24 16:38:21 CEST 2007

Iasonas Lamprianou sent the enclosed message to the R-SIG-Mixed-Models
mailing list.  It was deferred because the enclosed data in the form
of a zip file containing a .xls spreadsheet exceeded the limit on size
of messages.  I have made the data available as a .rda file (which is
less than 1/10 the size of the .xls file and about 1/3 the size of the
.zip file containing the .xls file) as


I enclose a transcript of a model fit to these data.  I will respond
to this posting with some comments.  That way the conversation becomes
properly threaded.

---------- Forwarded message ----------
From: Iasonas Lamprianou <lamprianou at yahoo.com>
To: r-sig-mixed-models at r-project.org
Date: Tue, 24 Jul 2007 06:38:28 -0700 (PDT)
Subject: partly crossed design
Hi all,
I have a dataset (attached) which shows the score of pupils on
different subjects. For example, pupil 13 may have been tested on
subjects 1 (Greek), subject 4 (History) and 5 (Latin) whereas pupil
124 may have been tested on subjects 1 (Greek), 38 (Physics) and 19
(Chemistry). All pupils took Greek (subject with code 1). I attach the
file with some data. Below, I show some of the R commands that I used.
My intention is to estimate which of the subjects was more difficlut,
and to estimate the % of variance because of pupils and because of
subjects. Please give me some help, also send me any commands you may
want to suggest and some explanations. I realized that SPSS 15 has
included a new mixed models component, is it much better than R?

channel <- odbcConnectExcel("C:/JASON/PROJECTS/vathmoi2007/alldata.xls")
channel <- odbcConnectExcel("C:\smalldata.xls")
sqlTables(channel, errors = FALSE, as.is = TRUE)
Dataset = sqlQuery(channel, paste("select * from [data$]"))
Dataset$mathima <- factor(Dataset$mathima)
Dataset$app_aa <- factor(Dataset$app_aa)

note: app_aa is the code of the pupil

this is the model for the analysis I used, but how do I show that the
pupils take more than one test?
mod2 <- lmer(arxiki ~ mathima + (1|app_aa), Dataset)

how about mod3 <- lmer(arxiki ~ 1 + (1|mathima) + (1|mathima:app_aa), Dataset)



Dr. Iasonas Lamprianou
Department of Education
The University of Manchester
Oxford Road, Manchester M13 9PL, UK
Tel. 0044 161 275 3485
iasonas.lamprianou at manchester.ac.uk

More information about the R-sig-mixed-models mailing list