# Repeated measurement analysis advice in R lme and / or aov and a couple of more questions

I want to analyse the visual performance, operationalized via contrast threshold, depending on adaptation luminance and spectrum, gathered for 29 subjects. I'm currently kind of confused of how to do that. Some of my data:

    ID C_measured Subject  LB Spectrum SpectrumLB
1  1 0.1339795   AHI11 0.1       HS     HS.0.1
2  2 0.1040440   AIC19 0.1       HS     HS.0.1
3  3 0.1363313   AUO13 0.1       HS     HS.0.1
4  4 0.1134103   BAR01 0.1       HS     HS.0.1
5  5 0.1117670   BAR02 0.1       HS     HS.0.1
6  6 0.1166350   BCL10 0.1       HS     HS.0.1


LB can be 0.1, 0.21, 0.3 and 1.0, Spectrum HS and LED

I know that I want to do 8 planned comparisons of Spectrum at each LB (4x) and the effect of reducing LB from 0.3 to 0.21 for both spectra with and without exchanging the spectrum (4x).

Some said I should do a two-way ANOVA, e.g. like

   aov(C_measured ~ LB * Spectrum + Error(Subject / (LB * Spectrum)), data = anovaFrameWithGlareFoveal)


and then a post-hoc test on the interaction variable SpectrumLB, e.g. like

anovaFrameWithGlareFoveal.lme <- lme(C_measured ~ LB, random = ~1 | Subject / LB, data = anovaFrameWithGlareFoveal)
anovaFrameWithGlareFoveal.glht <- glht(am2.subject, linfct = mcp(LB = "Tukey"))
summary(anovaFrameWithGlareFoveal.glht, test = adjusted(type = "none"))


then manually bonferroni-adjusting the p-value to the number of my planned comparisons.

I do that for a couple of other parameters (with glare, without glare, old reference group, young group), which I don't want to include in the statistical analysis, because it is common knowledge that this influences visual performance, I just want to analyse whether the planned comparisons differ for those parameters.

Till here the question: is this how to do it? DO I need the two-way ANOVA at all?

Then I observed some things: for some of the parameters I observed significant values in the two-way ANOVA for the main effect of Spectrum p<.05, but none of the uncorrected multiple comparisons between the two spectra at all four LBs was significant (ok one was <.1, but I'm testing against .05), which some people commented with "impossible". Is this possible?

Then people said: "ok paired t.tests should come up with the same results" so I did this:

df <- anovaFrameWithGlareFoveal
df.led <- subset(df, Spectrum == "LED")
df.hs <- subset(df, Spectrum == "HS")
t.test(df.led$C_measured[df.led$LB==.1], df.hs$C_measured[df.hs$LB==.1], paired=T)
t.test(df.led$C_measured[df.led$LB==.21], df.hs$C_measured[df.hs$LB==.21], paired=T)
t.test(df.led$C_measured[df.led$LB==.3], df.hs$C_measured[df.hs$LB==.3], paired=T)
t.test(df.led$C_measured[df.led$LB==1], df.hs$C_measured[df.hs$LB==1], paired=T)


then all of the t.tests were significant (<.05) but only one of the uncorrected multiple comparison was significant (<.05).

I'm not really that much into statistics that I can definitively argue for or against one method or combined methods or whether the lme + glht alone is sufficient. Had a tough time on that the last week and am really curiously looking forward to your comments!

• I have problems understanding why you perform a Tukey test but then use the non-adjusted p-values and correct them manually. I usually prefer Tukey over Bonferroni for this. – Roland Nov 8 '13 at 10:40
• well I actually don't know that either. Somehow I ended up with this. I'm wondering whether I should go for two-way ANOVA and then manually using t.tests or do the tukey test. I ended up manually correcting because I wanted to do "planned comparisons" (8x) and wanted to prevent the bonferroni correction for all of the combinations (28x) to decrease my confidence level too much – b00tsy Nov 8 '13 at 11:43