[Edited to make example cleaner]
I am new to pymc, and trying something out with mock dataset. I have a model with nested predictors (mouse, neuron). The model below assumes the same number of neurons per mouse. In pymc, how does one handle the case where there are a different dimension sizes for levels of a predictor, in my case different different number of neurons per mouse?
with pm.Model() as model: intercept_m = pm.Normal('intercept_m', mu=0, sd=10, shape=n_mouse) sigma_n = pm.Exponential('sigma_n', 1) z_intercept_n = pm.Normal('z_intercept_n', mu=0, sd=1, shape=(n_neuron, n_mouse)) intercept_n = pm.Deterministic('intercept_n', intercept_m + z_intercept_n * sigma_n) slope = pm.Normal('slope', mu=0, sd=10) theta = intercept_n[df.neuron, df.mouse] + slope * df.measure outcome = pm.Bernoulli("outcome", p=pm.invlogit(theta), observed=df.outcome)