Hello,
First time posting here!
I was working through the PyMC example, Forecasting with Structural AR Timeseries, when I noticed that the “standard deviation of the innovation term,” i.e., sigma, appears twice in the model definition.
priors = {
"coefs": {"mu": [10, 0.2], "sigma": [0.1, 0.1], "size": 2},
"sigma": 8,
"init": {"mu": 9, "sigma": 0.1, "size": 1},
}
...
with pm.Model() as AR:
pass
...
with AR:
...
sigma = pm.HalfNormal("sigma", priors["sigma"])
...
ar1 = pm.AR(
"ar",
coefs,
sigma=sigma, # (HERE!)
init_dist=init,
constant=True,
steps=t.shape[0] - (priors["coefs"]["size"] - 1),
dims="obs_id",
)
# The Likelihood (AND HERE!)
outcome = pm.Normal("likelihood", mu=ar1, sigma=sigma, observed=y, dims="obs_id")
## Sampling
idata_ar = pm.sample_prior_predictive()
idata_ar.extend(pm.sample(2000, random_seed=100, target_accept=0.95))
idata_ar.extend(pm.sample_posterior_predictive(idata_ar))
Why does it appear twice?
Thanks for your help!