[R] model reparameterization

casperyc casperyc at hotmail.co.uk
Fri Apr 2 22:53:56 CEST 2010


==================================
y=c(100,200,300,400,500)
treatment=c(1,2,3,3,4)
block=c(1,1,2,3,3)

summary(lm(y~as.factor(treatment)+as.factor(block)))
==================================

The aim is to find a model that can estimate
the comparison between treatment 1 with 2
and treatment 3 with 4.

I have tried all the possible ones
===========================================
relevel(as.factor(block),ref="1");relevel(as.factor(treatment),ref="1")
relevel(as.factor(block),ref="1");relevel(as.factor(treatment),ref="2")
relevel(as.factor(block),ref="1");relevel(as.factor(treatment),ref="3")
relevel(as.factor(block),ref="1");relevel(as.factor(treatment),ref="4")

relevel(as.factor(block),ref="2");relevel(as.factor(treatment),ref="1")
relevel(as.factor(block),ref="2");relevel(as.factor(treatment),ref="2")
relevel(as.factor(block),ref="2");relevel(as.factor(treatment),ref="3")
relevel(as.factor(block),ref="2");relevel(as.factor(treatment),ref="4")

relevel(as.factor(block),ref="3");relevel(as.factor(treatment),ref="1")
relevel(as.factor(block),ref="3");relevel(as.factor(treatment),ref="2")
relevel(as.factor(block),ref="3");relevel(as.factor(treatment),ref="3")
relevel(as.factor(block),ref="3");relevel(as.factor(treatment),ref="4")
============================================

each followed by a line of

summary(lm(y~as.factor(treatment)+as.factor(block)))

i seem to always get "NaN"s

Am I doing something wrong there?

What model should I use then?

Thanks!

casper

-- 
View this message in context: http://n4.nabble.com/model-reparameterization-tp1749621p1749621.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list