Hi there,
Is it possible to build a multi-level model with additional features for some of the groups and not others?
For example, in the simplest case I can think of, say I had two groups and I wanted a hierarchy on an intercept term and one feature, and I also wanted group 1 to have one additional feature.
def model(X, y, group_idx):
b0 = pm.Normal(0,1, shape=2)
b1 = pm.Normal(0,1,shape=2)
b2 = pm.Normal(0,1)
mu = b0[group_idx] + b1[group_idx]*X[0] * ??b2?? * X[1]
sigma = pm.HalfNormal(5)
y = pm.Normal(mu, sigma, observed=y)
I made this code up, so apologies if any mistakes, but I think it conveys the point. If anything is unclear I would be happy to clarify, thanks!