the model matrix and the contrasts [🇷 for BE/BA]
Dear ElMaestro!
I (and many others) understand your degree of discontent.
Yes, this is something unexpected.
I suppose you already read this answer
I have nothing to add to this: that's a price for identifiability. The only solution I see besides you already gave is to turn off the contrasts as shown there:
I (and many others) understand your degree of discontent.
Yes, this is something unexpected.
I suppose you already read this answer
I have nothing to add to this: that's a price for identifiability. The only solution I see besides you already gave is to turn off the contrasts as shown there:
f <- sample(gl(3, 4, labels = letters[1:3]))
# [1] c a a b b a c b c b a c
#Levels: a b c
g <- sample(gl(3, 4, labels = LETTERS[1:3]))
# [1] A B A B C B C A C C A B
#Levels: A B C
X0 <- model.matrix(~ f + g, contrasts.arg = list(
f = contr.treatment(n = 3, contrasts = FALSE),
g = contr.treatment(n = 3, contrasts = FALSE)))
# (Intercept) f1 f2 f3 g1 g2 g3
#1 1 0 0 1 1 0 0
#2 1 1 0 0 0 1 0
#3 1 1 0 0 1 0 0
#4 1 0 1 0 0 1 0
#5 1 0 1 0 0 0 1
#6 1 1 0 0 0 1 0
#7 1 0 0 1 0 0 1
#8 1 0 1 0 1 0 0
#9 1 0 0 1 0 0 1
#10 1 0 1 0 0 0 1
#11 1 1 0 0 1 0 0
#12 1 0 0 1 0 1 0
—
Kind regards,
Mittyri
Kind regards,
Mittyri
Complete thread:
- lm and the model matrix ElMaestro 2024-02-19 09:51 [🇷 for BE/BA]
- the model matrix and the contrastsmittyri 2024-02-22 20:21
- Yes, but.... ElMaestro 2024-02-23 17:41
- Yes, but.... mittyri 2024-02-23 19:39
- Yes, but.... ElMaestro 2024-02-23 22:15
- Yes, but.... mittyri 2024-02-23 19:39
- Yes, but.... ElMaestro 2024-02-23 17:41
- the model matrix and the contrastsmittyri 2024-02-22 20:21