[R] 2 x 2 x 10 x 2 binomial setup

Marc Schwartz marc_schwartz at me.com
Tue Jul 14 15:37:46 CEST 2009


On Jul 14, 2009, at 8:09 AM, Suresh Krishna wrote:

>
> Hello,
>
> I have a hierarchical dataset of this form and am trying to analyze  
> it in R.
>
> 1 subject
> Tested under 2 conditions: A and B
> 10 sesssions in each condition
> In each session, 2 kinds of tests: Test 1 and Test 2
> 200 independent repetitions of each test-type, with 200 Yes/No answers
>
> So I think this is a 2 x 2 x 10 x 2 setup
>
> What I want to know is whether the difference in percentage of yes  
> answers between Test1 and Test2 is different for the 2 conditions A  
> and B. I guess I could also state this as looking for an effect at  
> the highest stratum, after correctly pooling over all the lower  
> strata... i.e. Is there an "interaction" between the Effect of  
> Condition and the Effect of Test.
>
> I looked through Agresti and Pinheiro/Bates and couldn't find an  
> example covering this situation. I would be really grateful if you  
> could suggest a way to go about this analysis in R, or a place where  
> I could read about this.
>
> I considered:
>
> Pool data from all the sessions for a given condition and test  
> together, thus getting 2000 repetitions of Test1 and Test 2 in each  
> condition. Now I have a 2x2x2 setup, which maps on to something in  
> Agresti, but then I am ignoring within-session correlation  
> information.
>
> I could simply get a difference between Test1 and Test2 percentages  
> for each session, and then compare the distribution of these  
> differences in conditions A and B (with something like a t-test),  
> but then I only have 10 points (one for each session) and so I guess  
> I am throwing away a lot of information.
>
> Very best,
>
> Suresh


You are likely going to want to look at using glmer() in the 'lme4'  
CRAN package by Doug and Martin. This functionality post-dates P&B.

There is a R-sig-mixed models list where you are likely better off  
pursuing your query further, as there you will avail yourself of  
experts in the field, including the package authors.

More information on that list is here:

   https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

HTH,

Marc Schwartz




More information about the R-help mailing list