The metafor Package

A Meta-Analysis Package for R

Site Tools

tips:multiple_factors_interactions

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

 tips:multiple_factors_interactions [2020/06/26 06:49] – Wolfgang Viechtbauer tips:multiple_factors_interactions [2021/11/10 20:20] – Wolfgang Viechtbauer Both sides previous revisionPrevious revision2022/08/03 11:35 Wolfgang Viechtbauer 2021/11/10 20:20 Wolfgang Viechtbauer 2021/10/22 14:44 Wolfgang Viechtbauer 2020/06/26 06:49 Wolfgang Viechtbauer 2018/12/08 13:22 external editNext revision Previous revision2022/08/03 11:35 Wolfgang Viechtbauer 2021/11/10 20:20 Wolfgang Viechtbauer 2021/10/22 14:44 Wolfgang Viechtbauer 2020/06/26 06:49 Wolfgang Viechtbauer 2018/12/08 13:22 external editLast revisionBoth sides next revision Line 10: Line 10: dat <- dat.raudenbush1985 dat <- dat.raudenbush1985 - I copy the dataset into 'dat', which is a bit shorter and therefore easier to type further below. + I copy the dataset into ''dat'', which is a bit shorter and therefore easier to type further below. For illustration purposes, we will categorize the ''weeks'' variable (i.e., the number of weeks of contact prior to the expectancy induction) into three levels (0 weeks = "none", 1-9 weeks = "some", and 10+ weeks = "high"): For illustration purposes, we will categorize the ''weeks'' variable (i.e., the number of weeks of contact prior to the expectancy induction) into three levels (0 weeks = "none", 1-9 weeks = "some", and 10+ weeks = "high"): Line 109: Line 109: We have also not yet tested whether there is a difference between levels ''some'' and ''high'' of this factor. One could change the reference level of the ''weeks'' factor and refit the model to obtain this test. Alternatively, and more elegantly, we can just test the difference between these two coefficients directly. We can do this with: We have also not yet tested whether there is a difference between levels ''some'' and ''high'' of this factor. One could change the reference level of the ''weeks'' factor and refit the model to obtain this test. Alternatively, and more elegantly, we can just test the difference between these two coefficients directly. We can do this with: - anova(res.a1, L=c(0,1,-1,0)) + anova(res.a1, X=c(0,1,-1,0)) Line 339: Line 339: Now, the table with the model results directly provides the estimated average effect for each factor level combination. It is now also quite easy to test particular factor level combinations against each other. For example, to test the difference between levels ''some'' and ''high'' of the ''weeks'' factor within the ''blind'' level of the ''tester'' factor, we could use: Now, the table with the model results directly provides the estimated average effect for each factor level combination. It is now also quite easy to test particular factor level combinations against each other. For example, to test the difference between levels ''some'' and ''high'' of the ''weeks'' factor within the ''blind'' level of the ''tester'' factor, we could use: - anova(res.i2, L=c(0,1,-1,0,0,0)) + anova(res.i2, X=c(0,1,-1,0,0,0)) Line 365: Line 365: To test the same contrast within the ''aware'' level of the ''tester'' factor, we would use: To test the same contrast within the ''aware'' level of the ''tester'' factor, we would use: - anova(res.i2, L=c(0,0,0,0,1,-1)) + anova(res.i2, X=c(0,0,0,0,1,-1))
tips/multiple_factors_interactions.txt · Last modified: 2022/08/03 11:35 by Wolfgang Viechtbauer