I have the follwowing multiple regression, where y is of dimension Nx1 and X is of dimension NxK, where K=26.
with pm.Model() as model:
K_1 = pm.Normal(name="K_1", mu=0.0, sigma=1.0, shape=X.shape[1])
# Model error
eps_1 = pm.Gamma(name="eps_1", alpha=9.0, beta=4.0, shape=())
# Model mean
y_hat = pm.Deterministic(name="y_hat", var=pm.math.dot(X_1, K_1) )
# Likelihood
y_like = pm.Normal(name="y_like", mu=y_hat, sigma=eps_1, observed=y)
with model:
trace = pm.sample()
Obviously, I obtain the parameter K_1 which is of dimension 26x1, i.e. K_1[0], K_1[1], ..., K_1[25] .
Now, I would like to plot only the traces of the 7th to 10th parameter, i.e. K_1[7], K_1[8],K_1[9], K_1[10] .
I’ve tried,
az.plot_posterior(trace, var_names=[“K_1[7]”, “K_1[8]”, “K_1[9]”, “K_1[10]”])
However, this does not work.