Thanks Falk, much appreciated for your feedback.
To your first point, I believe what I’ve done is confused the configuration from this tutorial . I’ve re-read my reference material and simplified.
The individual dog calculations are still tripping me up, so I’m testing the following to just estimate a time based on age/sex + Distance
with pm.Model() as Model:
#Shared Hyperpriors
mu_dist = pm.Normal('mu_dist', mu=0, sd=1.5)
sigma_dist = pm.HalfCauchy('sigma_dist', 5)
mu_age = pm.Normal('mu_age', mu=0, sd=1.5)
sigma_age = pm.HalfCauchy('sigma_age', 5)
#Offset for distances, attempted non-centered parameterization as per T Wiecki
distance_offset = pm.Normal('distance_offset', mu=0, sd=1.5, shape=n_distances)
distance_a = pm.Deterministic('distance_a', mu_dist + distance_offset * sigma_dist)
#Offset for Age+Sex, attempted non-centered parameterization as per T Wiecki
agesex_offset = pm.Normal('agesex_offset', mu=0, sd=1.5, shape=n_agesex)
agesex_a = pm.Deterministic('agesex_a', mu_age + agesex_offset * sigma_age)
estimate = pm.Deterministic('estimate', distance_a[distance_idx] + agesex_a[agesex_idx])
y = pm.Normal("y", estimate, observed=dog_times)
trace = pm.sample(1000, tune=500, cores=4, return_inferencedata=True, init="advi+adapt_diag")
I am still unsure how to add in individual dog entries to this, would it just be a simple matter of adding another offset in a similar format to above? Intuitively, that doesn’t seem right to me.
Also, if it makes you feel better I shan’t be using this for betting, this is purely a learning experience!