[R-sig-ME] Fw: question about Type III sums of squares as computed in "CAR'

m51988mnew at juno.com m51988mnew at juno.com
Fri Nov 20 18:44:20 CET 2015



Please note: forwarded message attached

From: "m51988mnew at juno.com" <m51988mnew at juno.com>
To: :r-sig-mixed-models at r-project.org
Cc: m51988mnew at juno.com
Subject: Fw: question about Type III sums of squares as computed in "CAR' 
Date: Fri, 20 Nov 2015 17:41:53 GMT

SiteDayyoccidbDate      110.004613a01      120.004555a02      130.001759a03      210.002755a04      220.00043a05      310.001138a06      320.005983a07      330.003027a08      410.001202a09      420.003261a010      430.00652a011      110.002368b61      120.001521b62      130.001381b73      210.004089b74      220.001139b75      310.000723b76      320.001017b77      330.001621b78      410.000562b89      420.002402b810      430.003053b811                              library(car)          exp <- read.table(file="example.csv",sep=",",header=TRUE)    exp$Site <- as.factor(exp$Site)        exp$Day <- as.factor(exp$Day)        exp$occ <- as.factor(exp$occ)        exp$idb  <- as.factor(exp$idb)        exp$Date <- as.factor(exp$Date)        exp.lm1 <- lm(log(y) ~ occ + Date + occ: idb,data=exp)      an_lm13 <- Anova(exp.lm1, type=c("III"))      an_lm12 <- Anova(exp.lm1, type=c("II"))       exp.lm2 <- lm(log(y) ~ occ + Site + Site:Day + occ:idb,data=exp)     an_lm23 <- Anova(exp.lm2, type=c("III"))      an_lm22 <- Anova(exp.lm2, type=c("II"))       exp.lm3 <- lm(log(y) ~  Site + Site:Day ,data=exp)       an_lm33 <- Anova(exp.lm3, type=c("III"))      an_lm32 <- Anova(exp.lm3, type=c("II"))                                           r output:          > library(car)          > exp <- read.table(file="example.csv",sep=",",header=TRUE)      > exp$Site <- as.factor(exp$Site)        > exp$Day <- as.factor(exp$Day)        > exp$occ <- as.factor(exp$occ)        > exp$idb  <- as.factor(exp$idb)        > exp$Date <- as.factor(exp$Date)        > exp.lm1 <- lm(log(y) ~ occ + Date + occ: idb,data=exp)      >  an_lm13 <- Anova(exp.lm1, type=c("III"))       Error in Anova.III.lm(mod, error, singular.ok = singular.ok, ...) :       there are aliased coefficients in the model       > an_lm12 <- Anova(exp.lm1, type=c("II"))       > exp.lm2 <- lm(log(y) ~ occ + Site + Site:Day + occ:idb,data=exp)     >  an_lm23 <- Anova(exp.lm2, type=c("III"))       Error in Anova.III.lm(mod, error, singular.ok = singular.ok, ...) :       there are aliased coefficients in the model       > an_lm22 <- Anova(exp.lm2, type=c("II"))       > exp.lm3 <- lm(log(y) ~  Site + Site:Day ,data=exp)       >  an_lm33 <- Anova(exp.lm3, type=c("III"))       Error in Anova.III.lm(mod, error, singular.ok = singular.ok, ...) :       there are aliased coefficients in the model       > an_lm32 <- Anova(exp.lm3, type=c("II"))       >            

Please note: forwarded message attached

From: "m51988mnew at juno.com" <m51988mnew at juno.com>
To: r-sig-mixed-models at r-project.org
Subject: Fw: question about Type III sums of squares as computed in "CAR' 
Date: Fri, 20 Nov 2015 15:52:48 GMT

I have attached the example data and the r-code and r messages.The data are example measurements of exposures on 2 occupations ( a and b)on 11 sampling days.  Each occupation  has one measurement per day.  The 11 sampling days are at 4 sites:  3 days at 3 of the sites and  2 days at 1 site.  In addition, there were three  workers who did the second occupation  , labelled 6,7,8, for the variable idb.  I need the SAS type III sums of squares for each of the variables in the model, but you can see the error message in the R code: there are aliased coefficients in the model In SAS I believe that this problem is dealt with by placing constraints on the parameters.I would appreciate any suggestions.  I think that maybe I am formulating the model wrong.  Thanks,Stanley Shulman       

---------- Forwarded Message ----------
From: "m51988mnew at juno.com" <m51988mnew at juno.com>
To: r-sig-mixed-models at r-project.org
Subject: question about Type III sums of squares as computed in "CAR' 
Date: Wed, 18 Nov 2015 02:25:03 GMT

When I use "Anova" from the car library, I cannot get Type III sums of
 squares for nested data.  Maybe I am using the program wrong. SAS gives the
 Type III sums of squares. Thanks for any thoughts.Stanley Shulman

____________________________________________________________
NetZero now offers 4G mobile broadband. Sign up now.
http://www.netzero.net/?refcd=NZINTISP0512T4GOUT1


More information about the R-sig-mixed-models mailing list