tips:models_with_or_without_intercept
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
tips:models_with_or_without_intercept [2021/11/10 20:19] – Wolfgang Viechtbauer | tips:models_with_or_without_intercept [2024/06/12 17:45] – Wolfgang Viechtbauer | ||
---|---|---|---|
Line 162: | Line 162: | ||
Now we will fit the model, but remove the intercept, which can be done with: | Now we will fit the model, but remove the intercept, which can be done with: | ||
<code rsplus> | <code rsplus> | ||
- | res <- rma(yi, vi, mods = ~ factor(alloc) | + | res <- rma(yi, vi, mods = ~ 0 + factor(alloc), |
res | res | ||
</ | </ | ||
+ | Alternatively, | ||
<code output> | <code output> | ||
Mixed-Effects Model (k = 13; tau^2 estimator: REML) | Mixed-Effects Model (k = 13; tau^2 estimator: REML) | ||
Line 217: | Line 218: | ||
| | ||
1: -0.5180 0.4412 -1.1740 0.2404 | 1: -0.5180 0.4412 -1.1740 0.2404 | ||
- | 2: -0.9658 0.2672 -3.6138 0.0003 | + | 2: -0.9658 0.2672 -3.6138 0.0003 |
3: -0.4289 0.3449 -1.2434 0.2137 | 3: -0.4289 0.3449 -1.2434 0.2137 | ||
Line 229: | Line 230: | ||
</ | </ | ||
<code output> | <code output> | ||
- | Hypotheses: | + | Hypotheses: |
- | 1: | + | 1: |
- | 2: -factor(alloc)alternate + factor(alloc)systematic = 0 | + | 2: -factor(alloc)alternate + factor(alloc)systematic = 0 |
- | 3: -factor(alloc)random + factor(alloc)systematic = 0 | + | 3: -factor(alloc)random + factor(alloc)systematic = 0 |
Results: | Results: | ||
- | | + | |
- | 1: -0.4478 0.5158 -0.8682 0.3853 | + | 1: -0.4478 0.5158 -0.8682 0.3853 |
- | 2: | + | 2: |
3: | 3: | ||
</ | </ | ||
Line 289: | Line 290: | ||
Now what happens if we remove the intercept? | Now what happens if we remove the intercept? | ||
<code rsplus> | <code rsplus> | ||
- | res <- rma(yi, vi, mods = ~ ablat - 1, data=dat) | + | res <- rma(yi, vi, mods = ~ 0 + ablat, data=dat) |
</ | </ | ||
<code output> | <code output> |
tips/models_with_or_without_intercept.txt · Last modified: 2024/06/18 19:29 by Wolfgang Viechtbauer