#### Homework 12 Key #### #1. d <- dfReadDat("HW12_Data.dat") head(d) varPlot(d$Baseline) varPlot(d$Anticipation) table(d$Group) varDescribeBy(d$Baseline, d$Group) varDescribeBy(d$Anticipation, d$Group) #2. d$Group = factor(d$Group, levels = c('Deprived','Satiated','Hater')) #3. # Mello yello drinkers were randomly assigned into Deprived and Satiated groups # BUT mello yello drinkers versus mello yellow haters were not randomly assigned (they came into # as preexisting mello yello groups) so the difference score ANOVA approach would be less biased # than the ANCOVA approach #4. d$IrritationDiff = d$Anticipation - d$Baseline # increased from baseline contrasts(d$Group) = varContrasts(d$Group, Type = 'DUMMY', RefLevel = 1) # Probably better to set up the other contrasts as we need them Alternatively, # you could create a new variable for each dummy code #5. mOverall = lm(IrritationDiff ~ Group, data = d) Anova(mOverall, type = 3) # While this would be an appropriate check to see # if we are justified in interpreting the simple effects, # main effect of group is not significant (p = .521) so we cannot move forward # at least without further correction for multiple comparisons #6. # a) mDep = lm(IrritationDiff ~ Group, data = d) modelSummary(mDep) modelEffectSizes(mDep) confint(mDep) # Participants in the deprived Mello Yello group felt .42 units less irritated after anticipating # drinking an ice cold Mello Yello, b = -0.422,[-0.839, -0.005]. t(129) = -2.004, pEta^2 = .030, p = .047. # b) contrasts(d$Group) = varContrasts(d$Group, Type = 'DUMMY', RefLevel = 2) mSat = lm(IrritationDiff ~ Group, data = d) modelSummary(mSat) modelEffectSizes(mSat) confint(mSat) # Participants in the satiated Mello Yello group only felt .07 units less irritated after anticipating # drinking an ice cold Mello Yello and this change was not significant, t(129) = -0.332, # p = .741. # c) contrasts(d$Group) = varContrasts(d$Group, Type = 'DUMMY', RefLevel = 3) mHat = lm(IrritationDiff ~ Group, data = d) modelSummary(mHat) modelEffectSizes(mHat) confint(mHat) # Participants in the Mello Yello hater group only felt .07 units less irritated after anticipating # drinking an ice cold Mello Yello and this change was not significant, t(129) = -1.252, # p = .213. #7. ps = numeric(length = 3) ps[1] = modelSummary(mDep)$coefficients[1,4] ps[2] = modelSummary(mSat)$coefficients[1,4] ps[3] = modelSummary(mHat)$coefficients[1,4] p.adjust(ps,'holm') # 0.141 0.741 0.426 #8. '10' is the only correct answer #9. See word key