AR dims/coords/shape in v4

Thank you Ricardo for the reply. When I put time as the last dimension, I get a different error. (Note that I’m transposing the observed data so the dimension is now 2, 10000)

import pandas as pd
import pymc as pm
import numpy as np
import arviz as az

def create_ar_series(length, rho, sigma):
    res = []
    lastval = 0
    for i in np.arange(length):
        nextval = lastval * rho + np.random.normal(loc=0, scale=sigma)
        lastval = nextval
        res.append(lastval)
    return res

df = pd.DataFrame({'res1': create_ar_series(10000, .3, .1),
                   'res2': create_ar_series(10000, .3, .1),
                  })

with pm.Model(coords={"time": df.index.values, "series": [0, 1]}) as m:
    rho = pm.Normal("rho", shape=1)
    init = pm.Normal.dist(0, shape=1)
    sigma = pm.HalfNormal('sigma', size=1)
    ar1 = pm.AR("ar1", rho=rho, sigma=sigma, init_dist=init,
                constant=False, observed=df[['res1', 'res2']].values.T, dims=("series", "time",))

with m:
    trace = pm.sample()

results in

TypeError: Cannot convert Type TensorType(float64, (2, 10000)) (of Variable ar1{[[-0.12119..07470894]]}) into Type TensorType(float64, (1, None)). You can try to manually convert ar1{[[-0.12119..07470894]]} into a TensorType(float64, (1, None)).