I will be pleased to know, how to get the classic parametrisation in a two way analysis of varians: Classic parametrisation: Observed = intercept + row-effect + col-effect+ error, where sum af row-effect=0 and sum of col_effect=0 -- View this message in context: http://r.789695.n4.nabble.com/LM-two-way-analysis-classic-parametrisation-tp3573453p3573453.html Sent from the R help mailing list archive at Nabble.com.
LM/two way analysis/classic parametrisation
4 messages · kfl, David Winsemius, Rolf Turner
On Jun 4, 2011, at 10:33 AM, kfl wrote:
I will be pleased to know, how to get the classic parametrisation in a two way analysis of varians: Classic parametrisation: Observed = intercept + row-effect + col-effect+ error, where sum af row-effect=0 and sum of col_effect=0
?contrasts # which has a link to contr.sum
David Winsemius, MD West Hartford, CT
Thank you for your reply.
However, I don't undestand what your are telling me.
I would be pleased if you could give me the synstax in the following
examples:
#Exampel page side 372
trt<-gl(3,4,12,labels=c("T1","T2","T3"))
blk<-gl(4,1,12,labels=c("B1","B2","B3","B4"))
res<-c(13,7,9,3,6,6,3,1,11,5,15,5)
p372<-data.frame(trt,blk,res)
attach(p372)
model<-lm(res~trt+blk)
summary(model)
anova(model)
model.matrix(model)
I want to have a print from the classic parametrisation
What should be added in the model statement ?
--
View this message in context: http://r.789695.n4.nabble.com/LM-two-way-analysis-classic-parametrisation-tp3573453p3575143.html
Sent from the R help mailing list archive at Nabble.com.
On 06/06/11 03:01, kfl wrote:
Thank you for your reply.
However, I don't undestand what your are telling me.
I would be pleased if you could give me the synstax in the following
examples:
#Exampel page side 372
trt<-gl(3,4,12,labels=c("T1","T2","T3"))
blk<-gl(4,1,12,labels=c("B1","B2","B3","B4"))
res<-c(13,7,9,3,6,6,3,1,11,5,15,5)
p372<-data.frame(trt,blk,res)
attach(p372)
model<-lm(res~trt+blk)
summary(model)
anova(model)
model.matrix(model)
I want to have a print from the classic parametrisation
What should be added in the model statement ?
Nothing. Did you ***read*** the help for contrasts() as you were
advised to do?
To spell it out:
trt<- gl(3,4,12,labels=c("T1","T2","T3"))
blk<- gl(4,1,12,labels=c("B1","B2","B3","B4"))
contrasts(trt)<- "contr.sum"
contrasts(blk)<- "contr.sum"
# Alternatively set the contrasts equal to "contr.sum" globally:
# options(contrasts=c("contr.sum","contr.poly"))
res<- c(13,7,9,3,6,6,3,1,11,5,15,5)
p372<- data.frame(trt,blk,res)
fit<- lm(res ~ trt + blk,data=p372) # DON'T use attach()! Use the data argument for lm().
summary(fit)
cheers,
Rolf Turner