Hi:

On Mon, May 31, 2010 at 3:46 AM, Thomas Meigen <
T.Meigen@augenklinik.uni-wuerzburg.de> wrote:

> Dear Dennis,
>
> thank you for your fast response. Perhaps I should have described the
> experimental situation in more detail.
>
>
[The indented comment below is in reference to this part of the original
post,
 elided in the reply.]
1.  Use the nlme-Package and calculate a model with both within-
subjects effects "Condition1" and "Condition2"

library(nlme)
d.lme <- lme(Result~ Condition1*Condition2,data=d,
random= ~1 | Subject)

2. Finally, the multcomp-Package can be used to perform post-hoc
tests for  "Condition1" and "Condition2"

library(multcomp)
print(summary(glht(d.lme, linfct=mcp(Condition1="Tukey"))))
print(summary(glht(d.lme, linfct=mcp(Condition2="Tukey"))))

> > This tells you that Subject is being treated as a random block
> > factor, and that
> > Conditions 1 and 2 are combinations of treatments applied to each
> > subject. In
> > other words, this describes a randomized block design, so ordering
> > in time is
> > not represented in this model. Moreover, within-subject correlation
> > due to the
> > supposed repeated measures is not represented, either.
>

    In each subject we perform one recording for every possible

> combination of values of
> both factors Condition1 and Condition2. Ordering in time is
> not an issue here, because we do not want to study longitudinal
> changes in
> time.


Then it's not a repeated measures design IMO. Repeated measures designs
include a factor corresponding to temporal or spatial dependence that one
wants to account for in the analysis. This looks like a randomized block
design with two treatment factors applied within block (Subject)...but it
requires that the treatment combinations were assigned in random order
to subjects. Is that true?

On the other hand, as each combination of the 2 conditions was
> applied
> in each subject within an experimental session, I thought this must
> be analysed
> with a repeated-measures approach.
>
> As an example, the following lines show the beginning of a typical
> result file for
> the first 2 subjects A and B
>
> Nr      Subject Condition1      Condition2      Result
> 1       A       C1a     C2a     5.0000
> 2       A       C1a     C2b     3.0000
> 3       A       C1b     C2a     3.0000
> 4       A       C1b     C2b     3.0000
> 5       A       C1c     C2a     1.0000
> 6       A       C1c     C2b     4.0000
> 7       B       C1a     C2a     5.0000
> 8       B       C1a     C2b     4.0000
> 9       B       C1b     C2a     3.0000
> 10      B       C1b     C2b     2.0000
> 11      B       C1c     C2a     2.0000
> 12      B       C1c     C2b     3.0000
> ...
>

I'm curious about the response Result: are they counts, grades, some
other discrete measure, or  ?? If the response is discrete, then the
usual normal-theory model is not appropriate. You should instead
consider a generalized linear model fit, in which case
the lme4 package with function glmer() may be a better choice,
something like

library(lme4)
glmer(Result ~ Condition1 * Condition2 + (1 | Subject), data = mydata,
          family = poisson)

for starters.

Continuance of this discussion is probably better addressed on the mixed
models list, to which this reply is cc'ed.

[For those who missed the initial post on R-help, the poster is interested
in fitting a
model corresponding to a completely within-subject design with Subjects as a

random blocking factor and wants to perform pairwise
comparisons on the individual Condition1/2 factors by the Tukey method. ]

A couple of things to consider before closing:

(i) Should you go the generalized mixed model route as suggested above, the
standard
    Poisson model assumes that the mean and variance of the response are
equal. This
    assumption needs to be checked in practice, and you may end up having to
refit with
    a model that incorporates over- or under-dispersion.
(ii) If the interaction term in the model is significant, then your
comparisons should
     focus on the interactions rather than the individual factors. Use of
graphics to
     explore the nature of interactions is fairly easy to do in R (once you
know where
     to find them, of course :)

HTH,
Dennis

>
> [remainder snipped for brevity and lack of relevance to the present
> discussion]
>
>

	[[alternative HTML version deleted]]


