How do I predict on new, unseen data using GLM?

You can extract the coefficient samples from the trace and use those on new data points. That might look something like this:

n = 100
X = np.ones([n,2])
n_samples = len(trace)
predictions = np.empty([n, n_samples])
for i in range(n_samples):
    pt = trace[i]
    predictions[:,i] = pt['Intercept'] + pt['x[0]']*X[:,0] + pt['x[1]']*X[:,1]

Alternately, you can write the model using the non-GLM syntax which lets you more easily sample predictions on new data. There’s some examples here

1 Like