Hierarchical model using dummy coding

I want partial-pooling between categorical covariates. I’m also looking for a way to avoid ragged arrays for a model.

We can write out hierarchies (or levels model) like:

y_i = \alpha + \alpha_{age}[i]x_{age} + \epsilon_i

And then specify a global age prior, where local age \alpha's are estimated from the data/prior. The corresponding Stan code is more or less analogous, using the nested notation.

Can’t I alternatively just use dummy coding in the design matrix to avoid the nesting implementation?

So one group level covariate for \alpha_{gender} , where in the respective column in the design matrix, I code a column of 1’s, and then I just have n different covariates for \alpha_{race[n]}, n number of races.

The age submodel being something like: \alpha_{gender_{global}} + \alpha_{gender_{local}} x_{gender_{local}}.

I remember doing something like this when using a MH, but it’s been forever and I’ve since forgotten and lost all of my code/chops.

yeah, this is fine.