0
$\begingroup$

I am running a two-way anova test using Anova from car package. My data looks like this:

> head(x)
  Type Bin Score
1    0  SI 2.120
2    0   R 2.246
3    0   R 2.246
4    0   R 2.511
5    0   R 2.420
6    0   R 2.270

> summary(x)
 Type    Bin           Score      
 0:906   I :  68   Min.   :1.202  
 1:258   R :1570   1st Qu.:2.000  
 2:346   SI: 328   Median :2.280  
 3:436             Mean   :2.299  
 4: 20             3rd Qu.:2.622  
                   Max.   :3.233  

> lapply(x,class)
$Type
[1] "factor"

$Bin
[1] "factor"

$Score
[1] "numeric"

With an unbalanced design as follows:

> table(x$Type,x$Bin)

      I   R  SI
  0  42 702 162
  1   6 190  62
  2   2 296  48
  3  18 362  56
  4   0  20   0

So I after much research, I ended up using Anova from car package with Type III SS method. Here is how I am conducting the test:

> Anova(lm(Score ~ Bin * Type, data=x, contrasts=list(Bin=contr.sum, Type=contr.sum)),singular.ok = TRUE, type=3)

With results as follows:

Note: model has aliased coefficients
      sums of squares computed by model comparison

Anova Table (Type III tests)

Response: Score
           Sum Sq   Df F values   Pr(>F)    
Bin         0.000    0                      
Type        2.081    3   4.3875 0.004381 ** 
Bin:Type    5.494    6   5.7927 5.42e-06 ***
Residuals 308.700 1953                      
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Can someone please help me understand:

1) This particular line from the results? Why might the SS and DF be zero for Bin?

           Sum Sq   Df F values   Pr(>F)    
Bin         0.000    0                      

2) How this particular model still has aliased coefficients if Bin is not even being included in the final result?

Note: model has aliased coefficients
      sums of squares computed by model comparison

3) Is there a better way to conduct this test in R?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.