Hello! I am trying to do a simple multivariate regression using bayesian modeling. I am using real data from a CSV table. I am able to set up the model and sample from posterior, but I am confused with how to actually generate new predictions from new Xi data.
My training data have one Y (output) and 10 Xi input (i = 1 to 10). All X predictors are standardize.
I specified the parameters:
dY : Y output data
dX1 : 1st X column data
dX2 : 2nd X column data
…
dX10 : 10th X column data
My model:
with pm.Model() as model: a = pm.Normal('a', mu=dY.mean(), sd=10) B = pm.Normal('B', mu=0, sd=10, shape=10) sigma = pm.Uniform('sigma', lower=0, upper=10) mu = pm.Deterministic('mu', a + B[0] * dX1 + B[1] * dX2 + B[2] * dX3 + B[3] * dX4 + B[4] * dX5 + B[5] * dX6 + B[6] * dX7 + B[7] * dX8 + B[8] * dX9 + B[9] * X10) Y = pm.Normal('Y', mu=mu, sd=sigma, observed=dY) trace = pm.sample(1000, tune=1000)
When I use:
> Y_pred = pm.sample_posterior_predictive(trace, samples=1000, model=model)['Y']
I have all the Y_pred values generated by the model from the Xi original data.
If I wanted to predict new Y values from new Xi parameters? How should I use pm.sample_posterior_predictive?