BVAR example model fails

Hi,

the example notebook for vector auto-regressive models does not work PyMC version (5.18.1). The online version in the “latest” branch was executed with PyMC 5.0.1

Running the make_model function results in the following error:

/mybox/lib/python3.11/site-packages/pymc/data.py:440: FutureWarning: Data is now always mutable. Specifying the mutable kwarg will raise an error in a future release
warnings.warn(


ValueError Traceback (most recent call last)
Cell In[9], line 10
2 n_eqs = 2
3 priors = {
4 “lag_coefs”: {“mu”: 0.3, “sigma”: 1},
5 “alpha”: {“mu”: 15, “sigma”: 5},
6 “noise_chol”: {“eta”: 1, “sigma”: 1},
7 “noise”: {“sigma”: 1},
8 }
—> 10 model, idata = make_model(n_lags, n_eqs, df, priors)
11 #pm.model_to_graphviz(model)

Cell In[7], line 44, in make_model(n_lags, n_eqs, df, priors, mv_norm, prior_checks)
41 data_obs = pm.Data(“data_obs”, df.values[n_lags:], dims=[“time”, “equations”], mutable=True)
43 betaX = calc_ar_step(lag_coefs, n_eqs, n_lags, df)
—> 44 betaX = pm.Deterministic(
45 “betaX”,
46 betaX,
47 dims=[
48 “time”,
49 ],
50 )
51 mean = alpha + betaX
53 if mv_norm:

File /mybox/lib/python3.11/site-packages/pymc/model/core.py:2230, in Deterministic(name, var, model, dims)
2228 var = var.copy(model.name_for(name))
2229 model.deterministics.append(var)
→ 2230 model.add_named_variable(var, dims)
2232 from pymc.printing import str_for_potential_or_deterministic
2234 var.str_repr = types.MethodType(
2235 functools.partial(str_for_potential_or_deterministic, dist_name=“Deterministic”), var
2236 )

File /mybox/lib/python3.11/site-packages/pymc/model/core.py:1448, in Model.add_named_variable(self, var, dims)
1446 # This check implicitly states that only vars with .ndim attribute can have dims
1447 if var.ndim != len(dims):
→ 1448 raise ValueError(
1449 f"{var} has {var.ndim} dims but {len(dims)} dim labels were provided."
1450 )
1451 self.named_vars_to_dims[var.name] = dims
1453 self.named_vars[var.name] = var

ValueError: betaX has 2 dims but 1 dim labels were provided.

Can anybody please give me a hint on how to cope with the dimensions here?