Is this a valid syntax for lm()
Brian Smith <[email protected]>
| Newsgroups | gmane.comp.lang.r.general |
|---|---|
| Message-ID | <CAHUBDY_KMfT2mmv9+s3y-rf_j=Wub05Hdab6J4RetKfpUbbeXQ@mail.gmail.com> |
Hi,
I have below code
ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14)
trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69)
group <- gl(2, 10, 20, labels = c("Ctl","Trt"))
group1 <- head(gl(2, 10, 22, labels = c("Ctl1","Trt1")), 20)
weight <- c(ctl, trt)
dat = as.data.frame(cbind(weight, group, group1))
lm.D9 <- lm(weight ~ group * group1 - 1 - group1, dat)
I want to incorporate interaction between 2 variables group and
group1, however do not want to incorporate level-0 for group1 not the
intercept.
Therefore I used (-1 - group1) in the formula.
I would like to know if above is a valid syntax for the stated model.
Thanks and regards,