[R-sig-ME] lmer problem

Iasonas Lamprianou lamprianou at yahoo.com
Tue Jul 24 16:19:04 CEST 2007

<No dataset - too big>
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

----- Original Message ----
From: "r-sig-mixed-models-request at r-project.org" <r-sig-mixed-models-request at r-project.org>
To: r-sig-mixed-models at r-project.org
Sent: Friday, 20 July, 2007 1:00:13 PM
Subject: R-sig-mixed-models Digest, Vol 7, Issue 13

Send R-sig-mixed-models mailing list submissions to
    r-sig-mixed-models at r-project.org

To subscribe or unsubscribe via the World Wide Web, visit
or, via email, send a message with subject or body 'help' to
    r-sig-mixed-models-request at r-project.org

You can reach the person managing the list at
    r-sig-mixed-models-owner at r-project.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of R-sig-mixed-models digest..."

Today's Topics:

   1. multinomial mixed effects models (H. Skaug)


Message: 1
Date: Thu, 19 Jul 2007 10:21:50 +0200
From: "H. Skaug" <hskaug at gmail.com>
Subject: [R-sig-ME] multinomial mixed effects models
To: r-sig-mixed-models at r-project.org
    <ed96c8240707190121u5a4f2a92h6354e01dcca4b952 at mail.gmail.com>
Content-Type: text/plain


If you are willing to move outside R,
mixed effects multinomial models can be fit with the
commercial software AD Model Builder:


Ordered and unordered categorical responses can
be handled, and there is no limit on the number
of nesting levels (in principle). For an example see:


It is easy to call an AD Model Builder program from R:


There obviously are limitations on the size of the model,
and I will be happy to clarify if your problem at hand is within reach.


>I and several of my colleagues are wondering whether it is possible to
>use any of the methods of lme4 as it exists now to fit a mixed effects
>model with a response variable drawn from a multinomial distribution.
>glm does not include a multinomial family, so if it is possible to
>accomplish this I'm not sure how to do so.  Packages that do allow
>multinomial response variables (like multinomRob) don't seem to allow
>for the inclusion of random effects.
>If it is not currently possible to fit a data set with a categorical
>dependent variable with more than two levels, might this be possible in
>the forthcoming update to lme4?
>Finally, if it isn't possible now and won't be in the next version of
>the package either, would someone be willing to explain the conceptual
>or technical difficulties associated with including a response variable
>from a multinomial distribution in a mixed effects model?
>Thanks for any help,

    [[alternative HTML version deleted]]


R-sig-mixed-models mailing list
R-sig-mixed-models at r-project.org

End of R-sig-mixed-models Digest, Vol 7, Issue 13


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