Closed
Description
I'm trying to build a regression model, which takes into account errors both in x and y measurements. There is a solution here:
with pm.Model() as model:
intercept = pm.Normal('intercept', 0, sd=20)
gradient = pm.Normal('gradient', 0, sd=20)
epsilon = pm.HalfCauchy('epsilon', 5)
obs_x = pm.Normal('obs_x', mu=x, sd=x_err, shape=len(x))
obs_y = pm.Normal('obs_y', mu=y, sd=y_err, shape=len(y))
likelihood = pm.Normal('y', mu=intercept + gradient * obs_x,
sd=epsilon, observed=obs_y)
But as I understand, using obs_y
as observed
is not supported anymore and gives corresponding error. While it probably makes sense, I can't get around how to rewrite this model in another way? Is something like this correct?
with pm.Model() as model:
intercept = pm.Normal('intercept', 0, sd=20)
gradient = pm.Normal('gradient', 0, sd=20)
epsilon = pm.HalfCauchy('epsilon', 5)
obs_x = pm.Normal('obs_x', mu=x, sd=x_err, shape=len(x))
obs_y = pm.Normal('obs_y', mu=intercept + gradient * obs_x, sd=epsilon)
likelihood = pm.Normal('y', mu=obs_y,
sd=y_err, observed=y)
Metadata
Metadata
Assignees
Labels
No labels