[R] Type I SS and Type III SS problem

leeznar leeznar at yahoo.com.tw
Fri Sep 19 09:43:51 CEST 2008


Dear all:
I m a newer on R.  I have some problem when I use anova function.  I use anova function to get Type I SS results, but I also need to get Type III SS results.  However, in my code, there is some different between the result of Type I SS and Type III SS.  I don’t know why the “seqe” factor disappeared in the result of Type III SS.  How can I do?  

Here is my example and result.
a<-c(1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,14,14)
b<-c(1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2)
c<-c(2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2)
d<-c(2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1)
e<-c(1739,1633,1481,1837,1780,2073,1374,1629,1555,1385,1756,1522,1566,1643,
     1939,1615,1475,1759,1388,1483,1127,1682,1542,1247,1235,1605,1598,1718 )
KK<-data.frame(subj=as.factor(a), drug=as.factor(b), per=as.factor(c),  seqe=as.factor(d), Cmax=e)
M<- lm(Cmax ~ seqe+ subj:seqe + per + drug , data=KK)
anova(M)
drop1(M, test="F")

The result of Type I SS: 
Analysis of Variance Table
Response: Cmax
          Df Sum Sq Mean Sq F value Pr(>F)
seqe       1    585     585  0.0160 0.9014
per        1  63175   63175  1.7293 0.2131
drug       1  58149   58149  1.5917 0.2311
seqe:subj 12 634325   52860  1.4469 0.2660
Residuals 12 438395   36533

The result of Type III SS: 
Single term deletions
Model:
AUCt ~ seqe + subj:seqe + per + drug
          Df Sum of Sq      RSS      AIC F value  Pr(F)
<none>                 63208187      442
per        1   2100484 65308672      441  0.3988 0.5396
drug       1   4714183 67922370      442  0.8950 0.3628
seqe:subj 12  35813062 99021249      430  0.5666 0.8308

Best regards,
HY Lee


      _________________________________________________________________________________________________________
想知道無聊生活如何大變身嘛? http://tw.promote.mail.yahoo.com/dc/change.html



More information about the R-help mailing list