I'm having trouble with a nested ANOVA on a fairly simple dataset. Concentrations of a chemical were measured in the blood and two organs of four individuals. I would like to compare conc in each matrix by id:
If I run a plain vanilla -anova- I see that the concentration in one organ is different to blood, but not the other organ:
However, since the matrices are nested in the individual, I should run a nested ANOVA:
That doesn't look right! There's obvuiously something wrong with that model. But with such a simple dataset, the model should also, presumably, be simple. Your suggestions would be appreciated!
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int id float(matrix conc) 73 0 276 75 0 214 79 0 227 121 0 241 73 1 168 75 1 144 79 1 147 121 1 154 73 2 253 75 2 195 79 2 179 121 2 224 end
Code:
. anova conc matrix
Number of obs = 12 R-squared = 0.7328
Root MSE = 25.1319 Adj R-squared = 0.6735
Source | Partial SS df MS F Prob>F
-----------+----------------------------------------------------
Model | 15593.167 2 7796.5833 12.34 0.0026
|
matrix | 15593.167 2 7796.5833 12.34 0.0026
|
Residual | 5684.5 9 631.61111
-----------+----------------------------------------------------
Total | 21277.667 11 1934.3333
. pwcompare matrix, pveffects mcompare(scheffe)
Pairwise comparisons of marginal linear predictions
Margins : asbalanced
---------------------------
| Number of
| Comparisons
-------------+-------------
matrix | 3
---------------------------
-----------------------------------------------------
| Scheffe
| Contrast Std. Err. t P>|t|
-------------+---------------------------------------
matrix |
1 vs 0 | -86.25 17.77092 -4.85 0.003
2 vs 0 | -26.75 17.77092 -1.51 0.364
2 vs 1 | 59.5 17.77092 3.35 0.026
-----------------------------------------------------
Code:
. anova conc matrix / matrix|id /
Number of obs = 12 R-squared = 1.0000
Root MSE = 0 Adj R-squared =
Source | Partial SS df MS F Prob>F
-----------+----------------------------------------------------
Model | 21277.667 11 1934.3333
|
matrix | 15593.167 2 7796.5833 12.34 0.0026
matrix|id | 5684.5 9 631.61111
-----------+----------------------------------------------------
matrix|id | 5684.5 9 631.61111
|
Residual | 0 0
-----------+----------------------------------------------------
Total | 21277.667 11 1934.3333
. pwcompare matrix, pveffects mcompare(scheffe)
Pairwise comparisons of marginal linear predictions
Margins : asbalanced
---------------------------
| Number of
| Comparisons
-------------+-------------
matrix | 3
---------------------------
-----------------------------------------------------
| Scheffe
| Contrast Std. Err. t P>|t|
-------------+---------------------------------------
matrix |
1 vs 0 | -86.25 . . .
2 vs 0 | -26.75 . . .
2 vs 1 | 59.5 . . .
-----------------------------------------------------

Comment