title: PYMC3 Bayesian Prediction Cones
body: <p>I'm still learning PYMC3, but I cannot find anything on the following problem in the docs. Consider the Bayesian Structure Time Series (BSTS) model from <a href="https://stackoverflow.com/questions/45806799/pymc3-seasonal-variables">this question</a> with no seasonality. This can be modeled in PYMC3 as follows:</p>
  
  <pre><code>import pymc3, numpy, matplotlib.pyplot
  # generate some test data
  t = numpy.linspace(0,2*numpy.pi,100)
  y_full = numpy.cos(5*t)
  y_train = y_full[:90]
  y_test = y_full[90:]
  
  # specify the model
  with pymc3.Model() as model:
    grw = pymc3.GaussianRandomWalk('grw',mu=0,sd=1,shape=y_train.size)
    y = pymc3.Normal('y',mu=grw,sd=1,observed=y_train)
    trace = pymc3.sample(1000)
    y_mean_pred = pymc3.sample_ppc(trace,samples=1000,model=model)['y'].mean(axis=0)
  
    fig = matplotlib.pyplot.figure(dpi=100)
    ax = fig.add_subplot(111)
    ax.plot(t,y_full,c='b')
    ax.plot(t[:90],y_mean_pred,c='r')
    matplotlib.pyplot.show()
  </code></pre>
  
  <p>Now I would like to predict the behavior for the next 10 time steps, i.e., y_test. I would also like to include credible regions over this area produce a Bayesian cone, e.g., see <a href="https://blog.quantopian.com/bayesian-cone/" rel="noreferrer">here</a>. Unfortunately the mechanism for producing the cones in the aforementioned link is a little vague. In a more conventional AR model one could learn the mean regression coefficients and manually extend the mean curve. However, in this BSTS model there is no obvious way to do this. Alternatively, if there were regressors, then I could use a theano.shared and update it with a finer/extended grid to impute and extrapolate with sample_ppc, but thats not really an option in this setting. Perhaps sample_ppc is a red herring here, but its unclear how else to proceed. Any help would be welcome.</p>