Hi. You just need to have your data in long format and add the coordinates corresponding to the indices of the variable (i.e. column) you want to add to the model.
new_var_idx = pd.Categorical(df.new_var).codes #note that this function can give the wrong order if the df is not ordered in the precise way you need. It may be better to use dictionary indexing.
coords = {"Level": ["Basement", "Floor"], "obs_id": np.arange(floor.size),
"County":county_idx, "new_var": new_var_idx}
with varying_intercept_slope:
b_2 = pm.Normal("b_2", 0, 1, dims="new_var")
Another option is building up your model entirely without coordinates and assign the levels to each distribution via the “shape” parameter. Let’s say that the number of levels of one of your variables = n (e.g. n = len(df.varibale.unique()) ).
with pm.Model() as model:
a = pm.Normal("a", 0, 1, shape=n)
And you could do that for each one of your variables. There are some advantages to using model coordinates, though. Hope this helps.