[R] GLMM and data manipulation (2nd try)

Giovanni Petris GPetris at uark.edu
Fri May 2 22:06:31 CEST 2008


Hello,

I posted a question yesterday but I got no replies, so I'll try to
reformulate it in a more concise way. 

I have the following data, summarizing approval ratings on two
different surveys for a random sample of 1600 individuals:

> ## Example: Ratings of prime minister (Agresti, Table 12.1, p.494)
> rating <- matrix(c(794, 86, 150, 570), 2, 2)
> dimnames(rating) <- list(First = c("approve", "disapprove"),
+                          Second = c("approve", "disapprove"))
> rating
            Second
First        approve disapprove
  approve        794        150
  disapprove      86        570

I would like to fit a logit model with approve/disapprove as response,
survey (first/second) as a fixed effect, and subject as a random
effect. 

1) Is it possible to fit such a model directly using "lmer"?

or 

2) Should I unroll the table above into a dataframe containing also
   fictitious subject id's? If this is the case, what is a clean way
   of doing it? 

Thank you in advance,
Giovanni Petris

-- 

Giovanni Petris  <GPetris at uark.edu>
Associate Professor
Department of Mathematical Sciences
University of Arkansas - Fayetteville, AR 72701
Ph: (479) 575-6324, 575-8630 (fax)
http://definetti.uark.edu/~gpetris/



More information about the R-help mailing list