tips:multiple_factors_interactions
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revisionNext revisionBoth sides next revision | ||
tips:multiple_factors_interactions [2018/12/08 13:22] – external edit 127.0.0.1 | tips:multiple_factors_interactions [2021/11/10 20:20] – Wolfgang Viechtbauer | ||
---|---|---|---|
Line 10: | Line 10: | ||
dat <- dat.raudenbush1985 | dat <- dat.raudenbush1985 | ||
</ | </ | ||
- | I copy the dataset into ' | + | 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 '' | For illustration purposes, we will categorize the '' | ||
Line 109: | Line 109: | ||
We have also not yet tested whether there is a difference between levels '' | We have also not yet tested whether there is a difference between levels '' | ||
<code rsplus> | <code rsplus> | ||
- | anova(res.a1, | + | anova(res.a1, |
</ | </ | ||
<code output> | <code output> | ||
Line 172: | Line 172: | ||
</ | </ | ||
<code output> | <code output> | ||
- | | + | |
1 0.4020 0.1300 | 1 0.4020 0.1300 | ||
2 0.1127 0.0804 -0.0448 0.2702 -0.1345 0.3599 | 2 0.1127 0.0804 -0.0448 0.2702 -0.1345 0.3599 | ||
Line 182: | Line 182: | ||
</ | </ | ||
<code output> | <code output> | ||
- | | + | |
1 0.3509 0.1297 | 1 0.3509 0.1297 | ||
2 0.0616 0.0735 -0.0824 0.2056 -0.1772 0.3004 | 2 0.0616 0.0735 -0.0824 0.2056 -0.1772 0.3004 | ||
3 -0.0913 0.0857 -0.2592 0.0767 -0.3452 0.1627 | 3 -0.0913 0.0857 -0.2592 0.0767 -0.3452 0.1627 | ||
</ | </ | ||
- | Note that, by default, the intercept is automatically included in the calculation of these predicted values (so only a vector of length 3 or a matrix with 3 columns should be specified via the '' | + | Note that, by default, the intercept is automatically included in the calculation of these predicted values (so only a vector of length 3 or a matrix with 3 columns should be specified via the '' |
We can use an alternative model specification, | We can use an alternative model specification, | ||
Line 300: | Line 300: | ||
</ | </ | ||
<code output> | <code output> | ||
- | | + | |
1 -0.1074 0.1134 -0.3296 0.1148 -0.4751 0.2602 | 1 -0.1074 0.1134 -0.3296 0.1148 -0.4751 0.2602 | ||
</ | </ | ||
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 '' | 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 '' | ||
<code rsplus> | <code rsplus> | ||
- | anova(res.i2, | + | anova(res.i2, |
</ | </ | ||
<code output> | <code output> | ||
Line 365: | Line 365: | ||
To test the same contrast within the '' | To test the same contrast within the '' | ||
<code rsplus> | <code rsplus> | ||
- | anova(res.i2, | + | anova(res.i2, |
</ | </ | ||
<code output> | <code output> |
tips/multiple_factors_interactions.txt · Last modified: 2023/05/30 07:51 by Wolfgang Viechtbauer