1 / 42

Unit 28B – The Analysis of Categorical Independent Variables with more than Two Levels

(= Contrast Analysis). Unit 28B – The Analysis of Categorical Independent Variables with more than Two Levels. Create m -1 orthogonal contrasts,. regress the DV on all contrasts, and. Contrasts - Take-home message. test two conditions:. (1) Is the contrast of interest (c1) significant?.

gordon
Download Presentation

Unit 28B – The Analysis of Categorical Independent Variables with more than Two Levels

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. (= Contrast Analysis) Unit 28B – The Analysis of Categorical Independent Variables with more than Two Levels

  2. Create m-1 orthogonal contrasts, regress the DV on all contrasts, and Contrasts - Take-home message test two conditions: (1) Is the contrast of interest (c1) significant? (2) Are the "other contrasts" as a set non-significant? If both conditions are satisfied, then the data confirm the hypothesized pattern of means.

  3. We predict that a certain pattern of means depends on another variable. Contrasts and interactions Ex: We predict that the difference between a treatment condition and two control conditions is stronger for one type of participant than for another.

  4. Example - our prediction: MEN WOMEN Ease of processing of emotion-relevant stimuli G1 G2 G3 G1 G2 G3 Exposure to emotional pictures Exposure to neutral pictures No exposure to pictures Exposure to emotional pictures Exposure to neutral pictures No exposure to pictures Design?  2 x 3 between-subjects design H1: G1 > G2 = G3 H2: This effect is moderated by gender.

  5. Step 1: Create m-1 contrasts for the categorical IV with more than two levels . Five-step process: here: c1 .67 -.33 -.33 c2 0 .5 -.5 d$c1 <- varRecode(d$group, c(1,2,3), c(.67,-.33,-.33)) d$c2 <- varRecode(d$group, c(1,2,3), c(0,.5,-.5)) Step 2: Center the other categorical IV. d$sexC <- varRecode(d$sex, c(1,2), c(.5,-.5))

  6. Step 3: Compute the product scores d$interc1 <- c1 * sexC d$interc2 <- c2 * sexC

  7. Step 3: Compute the product scores d$interc1 <- c1 * sexC d$interc2 <- c2 * sexC Step 4: Regress the DV on all variables created in the previous steps mod <- lm(ease ~ c1 + c2 + sexC + interc1 + interc2, data=d) modelSummary(mod) modelEffectSizes(mod) Step 5: Check the two conditions for each of the two hypotheses.

  8. Coefficients Estimate SE t-statistic Pr(>|t|) (Intercept) 7.5258 1.5583 4.830 1.17e-05 *** c1 7.2003 3.3027 2.180 0.0336 * c2 1.4005 3.8200 0.367 0.7153 sexC -0.5589 3.1165 -0.179 0.8584 interc1 -13.3449 6.6054 -2.020 0.0483 * interc2 -0.2899 7.6400 -0.038 0.9699 Sum of squared errors (SSE): 7840.3, Error df: 54 R-squared: 0.1455 Coefficients SSR df pEta-sqr dR-sqr (Intercept) 3386.6014 1 0.3016 NA c1 690.0867 1 0.0809 0.0752 c2 19.5156 1 0.0025 0.0021 sexC 4.6692 1 0.0006 0.0005 interc1 592.6279 1 0.0703 0.0646 interc2 0.2090 1 0.0000 0.0000 Sum of squared errors (SSE): 7840.3 Sum of squared total (SST): 9175.0 __________ __________ __________ __________

  9. We first examined Hypothesis 1. Participants who had been exposed to emotional pictures processed emotional stimuli with greater ease (M = 12.35, SD = 12.81) than participants who had been exposed to neutral pictures (M = 5.85, SD = 12.02) or to no pictures (M = 4.25, SD = 11.64). The contrast of interest (2, -1, -1) was statistically significant, F(1,54) = 4.75, p < .04, partialη2 = .08, whereas the contrast testing the residual between-group variance (0, 1, -1) was not, F(1,54) = .13, p = .72, partialη2 = .003. Conclusion

  10. As predicted, this effect was moderated by gender (Hypothesis 2). The effect of exposure to emotional pictures on the ease of processing of emotional stimuli was stronger for women than for men (see Figure 1). The interaction between the contrast of interest and gender was statistically significant, F(1,54) = 4.08, p < .05, partialη2 = .07, whereas the interaction between the "other" contrast and gender was not, F(1,54) = .00, p = .97, partialη2 = .00. Conclusion (cont'd)

  11. Questions?

  12. What about a continuous moderator IV? Ex: We predict that the relationship between two variables is moderated by participant group (which has four levels). Contrasts and interactions

  13. Example - our prediction: Blond Caucasians Brown Caucasians Likelihood of skin cancer US Blacks G1 G2 G3 Immigrated Blacks Amount of exposure to sunlight

  14. Step 1: Create m-1 contrasts for the categorical IV with more than two levels . Five-step process Immigr. US Brown Blond Blacks Blacks Caucas. Caucas. here: c1 -3 -3 1 5 c2 __ __ __ __ c3 __ __ __ __

  15. Step 1: Create m-1 contrasts d$c1 <-varRecode(d$group,c(1,2,3,4),c(-.75,-.75,.25,1.25)) d$c2 <-varRecode(d$group,c(1,2,3,4),c(-.25,-.25,1,-.5)) d$c3 <-varRecode(d$group,c(1,2,3,4),c(.5,-.5,0,0)) Five-step process Step 2: Center the other IV d$exposeC <- d$expose - mean(d$expose) Step 3: Compute the product scores d$interc1 <- d$c1 * d$exposeC d$interc2 <- d$c2 * d$exposeC d$interc3 <- d$c3 * d$exposeC

  16. Step 4: Regress the DV on all variables created in the previous steps Five-step process mod <- lm(likeli ~ c1 + c2 + c3 + exposeC + interc1 + interc2 + interc3, data=d) modelSummary(mod) modelEffectSizes(mod) Step 5: Check the two conditions for the focal hypothesis

  17. Estimate SE t-statistic Pr(>|t|) (Intercept) 5.393068 0.269478 20.013 < 2e-16 *** c1 3.431053 0.329900 10.400 5.48e-16 *** c2 -1.002781 0.455112 -2.203 0.0308 * c3 -0.175616 0.758061 -0.232 0.8175 exposeC 0.094329 0.011852 7.959 1.83e-11 *** interc1 0.116259 0.014670 7.925 2.12e-11 *** interc2 -0.003355 0.020302 -0.165 0.8692 interc3 -0.013027 0.032464 -0.401 0.6894 SSR df pEta-sqr dR-sqr (Intercept) 2223.6760 1 0.8476 NA c1 600.5324 1 0.6004 0.4164 c2 26.9540 1 0.0632 0.0187 c3 0.2980 1 0.0007 0.0002 exposeC 351.7005 1 0.4680 0.2439 interc1 348.6706 1 0.4659 0.2418 interc2 0.1516 1 0.0004 0.0001 interc3 0.8940 1 0.0022 0.0006 Sum of squared errors (SSE): 399.7 Sum of squared total (SST): 1442.1 Condition __

  18. > mod1 <- lm(likeli ~ c1 + c2 + c3 + exposeC + interc1, data=d) > modelCompare(mod1,mod) SSE (Compact) = 400.8059 SSE (Augmented) = 399.7413 PRE = 0.002656229 F(2,72) = 0.09587891, p = 0.9086898 Condition __ Both conditions are satisfied. The data are consistent with the hypothesized relationships.

  19. We had - Contrasts What's next? - Contrasts and interactions - Contrasts and ???

  20. Our prediction Liking 2 blocks away 1 floor away 3 floors away Next building Distance

  21. Frequency of contact Distance Liking Contrasts and mediation Frequency of contact Liking 4 1 2 3

  22. Step 1: Create m-1 contrasts for the categorical IV with more than two levels . Five-step process: 1 floor 3 floors next 2 blocks away away building away here: c1 3 1 -1 -3 Lin. c2 __ __ __ __ c3 __ __ __ __ Quad. Cubic

  23. Step 2: Test whether there is an effect of X (the linear trend of distance) on Y (liking)? mod1 <- lm(like ~ c1 + c2 + c3, data=d) modelSummary(mod1) modelEffectSizes(mod1) mod1b <- lm(like ~ c1, data=d) modelCompare(mod1b,mod1)

  24. Coefficients Estimate SE t-statistic Pr(>|t|) (Intercept) 55.6875 3.0390 18.324 <2e-16 *** c1 3.5375 1.3591 2.603 0.0111 * c2 0.5625 3.0390 0.185 0.8536 c3 -0.5125 1.3591 -0.377 0.7072 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘’ 1 Sum of squared errors (SSE): 56151.2, Error df: 76 R-squared: 0.0838 Coefficients SSR df pEta-sqr dR-sqr (Intercept) 248087.8125 1 0.8154 NA c1 5005.5625 1 0.0818 0.0817 c2 25.3125 1 0.0005 0.0004 c3 105.0625 1 0.0019 0.0017 Sum of squared errors (SSE): 56151.2 Sum of squared total (SST): 61287.2 Condition __

  25. > mod1b <- lm(like ~ c1, data=d) > modelCompare(mod1b,mod1) SSE (Compact) = 56281.62 SSE (Augmented) = 56151.25 PRE = 0.002316475 F(2,76) = 0.08823045, p = 0.9156435 Condition __ Both conditions are satisfied. There is an effect of X (linear trend of distance) on Y (liking). The further other students live away, the less the participants like them.

  26. Step 3: Test whether there is an effect of X (the linear trend of distance) on M (frequency of contact). mod2 <- lm(frequ ~ c1 + c2 + c3, data=d) modelSummary(mod2) modelEffectSizes(mod2) mod2b <- lm(frequ ~ c1, data=d) modelCompare(mod2b,mod2)

  27. Coefficients Estimate SE t-statistic Pr(>|t|) (Intercept) 7.2125 0.5382 13.401 < 2e-16 *** c1 1.2125 0.2407 5.038 3.1e-06 *** c2 -0.2125 0.5382 -0.395 0.694 c3 -0.0375 0.2407 -0.156 0.877 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘’ 1 Sum of squared errors (SSE): 1761.1, Error df: 76 R-squared: 0.2517 Coefficients SSR df pEta-sqr dR-sqr (Intercept) 4161.6125 1 0.7026 NA c1 588.0625 1 0.2503 0.2499 c2 3.6125 1 0.0020 0.0015 c3 0.5625 1 0.0003 0.0002 Sum of squared errors (SSE): 1761.1 Sum of squared total (SST): 2353.4 Condition 1

  28. > mod2b <- lm(frequ ~ c1, data=d) > modelCompare(mod2b,mod2) SSE (Compact) = 1765.325 SSE (Augmented) = 1761.15 PRE = 0.002365004 F(2,76) = 0.09008318, p = 0.9139526 Condition 2 Both conditions are satisfied. There is an effect of X (linear trend of distance) on M (frequency of contact). The further other students live away, the less frequently participants are in contact with them.

  29. Step 4: Test whether there is an effect of M (frequency of contact) on Y (liking) and whether effect of X (the linear trend of distance) on Y (liking) disappears when we statistically control for M (frequency of contact) ? mod3 <- lm(like ~ frequ + c1 + c2 + c3, data=d) modelSummary(mod3) modelEffectSizes(mod3)

  30. Coefficients Estimate SE t-statistic Pr(>|t|) (Intercept) 33.2062 4.6778 7.099 6.06e-10 *** frequ 3.1170 0.5437 5.733 1.95e-07 *** c1 -0.2419 1.3175 -0.184 0.855 c2 1.2249 2.5534 0.480 0.633 c3 -0.3956 1.1409 -0.347 0.730 Sum of squared errors (SSE): 39040.5, Error df: 75 R-squared: 0.3630 Coefficients SSR df pEta-sqr dR-sqr (Intercept) 26230.0566 1 0.4019 NA frequ 17110.7573 1 0.3047 0.2792 c1 17.5412 1 0.0004 0.0003 c2 119.7773 1 0.0031 0.0020 c3 62.5837 1 0.0016 0.0010 Sum of squared errors (SSE): 39040.5 Sum of squared total (SST): 61287.2 *1 *2 *1: tests the effect of __ on __ (when statistically controlling for __) *2: tests the effect of __ on __ when statistically controlling for __

  31. All four conditions of mediation are satisfied: • There is an effect of X (linear trend of distance) on Y (liking). • There is an effect of X (linear trend of distance) on M (frequency of contact). • There is an effect of M (frequency of contact) on Y (liking). • The effect of X (linear trend of distance) on Y (liking) disappears if one statistically controls for M (frequency of contact). Contrasts and mediation

  32. Step 5: Test the reverse mediational model (X  Y  M). Test whether there is an effect of Y (liking) on M (frequency of contact) and whether effect of X (the linear trend of distance) on M (frequency of contact) disappears when we statistically control for Y (liking). mod4 <- lm(frequ ~ like + c1 + c2 + c3, data=d) modelSummary(mod4) modelEffectSizes(mod4)

  33. Coefficients Estimate SE t-statistic Pr(>|t|) (Intercept) 1.76834 1.05155 1.682 0.0968 . like 0.09776 0.01705 5.733 1.95e-07 *** c1 0.86666 0.21084 4.110 9.99e-05 *** c2 -0.26749 0.45185 -0.592 0.5556 c3 0.01260 0.20222 0.062 0.9505 Sum of squared errors (SSE): 1224.5, Error df: 75 R-squared: 0.4797 Coefficients SSR df pEta-sqr dR-sqr (Intercept) 46.1705 1 0.0363 NA like 536.6686 1 0.3047 0.2280 c1 275.8522 1 0.1839 0.1172 c2 5.7216 1 0.0047 0.0024 c3 0.0634 1 0.0001 0.0000 Sum of squared errors (SSE): 1224.5 Sum of squared total (SST): 2353.4 *1 *2 *1: tests the effect of Y on M (when statistically controlling for X) *2: tests the effect of X on M when statistically controlling for Y

  34. All four conditions of the following mediational model are satisfied: Linear trend of distance Frequency of contact Contrasts and mediation Liking The data are inconsistent with the following mediational model: Linear trend of distance Frequency of contact Liking The data are consistent with the hypothesized mediational model!

  35. It is possible to test for moderation and mediation if one has categorical IVs with three or more levels. Take-home message Where we looked at one p-value before, we now look at two p-values. Questions?

More Related