Dear R-help, I posted this on 4 Oct but got no response (I wasn't even told to go away and do some more background reading ;) ). I am reposting it in the, perhaps, vain hope that someone with knowledge of the subject will reply, if only to point me in a different direction to which I am now facing. Earlier Posting:--- I am sorry if this is more of a stats question than an R-question, but I have found it difficult to get a clear answer by other means. Q. Would it be "wrong" to specify a nested model and retain a common intercept, e.g. lm(NH4 ~ Site/TideCode + 1) I am aware (?) that my Site-coefficients are now calculated relative to my reference Site (treatment.contrasts), *but* that my TideCode levels now relate to their reference level within Site. Is that correct? Thank you in advance for help. Regards, Mark Difford. Mark Difford Ph.D. candidate, Botany Department, Nelson Mandela Metropolitan University, Port Elizabeth, SA. Send instant messages to your online friends http://uk.messenger.yahoo.com
I f I understand you correctly, I don't think that your model is doing
what you think it is.
Look at the model.matrix. Consider a toy example:
> x <- 1:10
> y <- factor(letters[1:2])
> dd <- expand.grid(x, y)
> dd$resp <- rnorm(20)
model.matrix(~Var2/Var1+1, dd)
(Intercept) Var2b Var2a:Var1 Var2b:Var1
1 1 0 1 0
2 1 0 2 0
3 1 0 3 0
4 1 0 4 0
5 1 0 5 0
6 1 0 6 0
7 1 0 7 0
8 1 0 8 0
9 1 0 9 0
10 1 0 10 0
11 1 1 0 1
12 1 1 0 2
13 1 1 0 3
14 1 1 0 4
15 1 1 0 5
16 1 1 0 6
17 1 1 0 7
18 1 1 0 8
19 1 1 0 9
20 1 1 0 10
attr(,"assign")
[1] 0 1 2 2
attr(,"contrasts")
attr(,"contrasts")$Var2
[1] "contr.treatment"
Do you want something more like the following?
model.matrix(~Var2:Var1, dd)
(Intercept) Var2a:Var1 Var2b:Var1
1 1 1 0
2 1 2 0
3 1 3 0
4 1 4 0
5 1 5 0
6 1 6 0
7 1 7 0
8 1 8 0
9 1 9 0
10 1 10 0
11 1 0 1
12 1 0 2
13 1 0 3
14 1 0 4
15 1 0 5
16 1 0 6
17 1 0 7
18 1 0 8
19 1 0 9
20 1 0 10
attr(,"assign")
[1] 0 1 1
attr(,"contrasts")
attr(,"contrasts")$Var2
[1] "contr.treatment"
although, an expert will surely correct me, if I'm in error here....
> Q. Would it be "wrong" to specify a nested model and retain a
common
> intercept, e.g.
>
> lm(NH4 ~ Site/TideCode + 1)
>
> I am aware (?) that my Site-coefficients are now calculated relative
> to my reference Site (treatment.contrasts), *but* that my TideCode
> levels now relate to their reference level within Site.
>
> Is that correct?
>
> Thank you in advance for help.
>
> Regards,
> Mark Difford.
--
Ken Knoblauch
Inserm U371
Institut Cellule Souche et Cerveau
Département Neurosciences Intégratives
18 avenue du Doyen Lépine
69500 Bron
France
tel: +33 (0)4 72 91 34 77
fax: +33 (0)4 72 91 34 61
portable: +33 (0)6 84 10 64 10
http://www.lyon.inserm.fr/371/
[[alternative text/enriched version deleted]]