## Yes, but.... [🇷 for BE/BA]

Hi Mittyri,

Nice, but are you aware that this model matrix is also not full rank, but rank-deficient? A cardinal question was how to get the (or a) full rank matrix.

The rank of your X0 is 5 but there are 7 columns. Seems you went to the opposite extreme of full rank, i.e. one column for every level of factors, plus intercept. Deficiency here = 2 redundant columns.

Anyways, I guess I will just live with it and do my stuff in a dumb but necessary fashion. Keep me posted if you find a nifty way of generating a full rank matrix model, please.

❝ 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)))

Nice, but are you aware that this model matrix is also not full rank, but rank-deficient? A cardinal question was how to get the (or a) full rank matrix.

The rank of your X0 is 5 but there are 7 columns. Seems you went to the opposite extreme of full rank, i.e. one column for every level of factors, plus intercept. Deficiency here = 2 redundant columns.

Anyways, I guess I will just live with it and do my stuff in a dumb but necessary fashion. Keep me posted if you find a nifty way of generating a full rank matrix model, please.

—

Pass or fail!

ElMaestro

Pass or fail!

ElMaestro

### Complete thread:

- lm and the model matrix ElMaestro 2024-02-19 09:51 [🇷 for BE/BA]
- the model matrix and the contrasts mittyri 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 contrasts mittyri 2024-02-22 20:21