Hi Everyone,

I’m having some hard time in designing the hierarchical model to fit the task I would to achieve, and I’m looking for some help/discussion.

I have a simple regression that I want to perform y ~ beta*x and I’m interested in the beta. Very easy. In the table I have, x and y belong to different categories, so that they look something like:

```
| y | x | cat 1 | cat 2 | cat 3 |
| ----- | ----- | ------ | ------ | ----- |
| 11 | 1 | A1 | B1 | C3 |
| 12 | 2 | A1 | B2 | C3 |
| 13 | 3 | A1 | B3 | C2 |
| 13 | 3 | A1 | B3 | C2 |
| 110 | 11 | A2 | B2 | C1 |
| 210 | 12 | A2 | B2 | C1 |
| 310 | 13 | A2 | B3 | C3 |
| 310 | 13 | A2 | B3 | C3 |
| 1 | -5 | A3 | B1 | C2 |
| 2 | -4 | A3 | B1 | C2 |
| 3 | -3 | A3 | B3 | C3 |
```

I have reason to believe that the beta described in the different groups refers to the same latent variable, so I was interested in a hierarchical model.

Should the model look like (after categorical factorisation):

```
for (entry_i in 1:cat1 ){
for (entry_j in 1:cat2) {
for(entry_z in 1:cat3){
y~beta*x
}}}
```

I can’t figure out how it should be represented

Thanks for your help!