Sorry if this is a very easy solution - I searched for a few hours and wasn’t able to find a solution that I understood.
I was wondering if there was a way to introduce uncertainty in a parameter that is being used in the model, without adding it to the chain. For example, suppose I have a linear relationship between two parameters
y, such that
y = Ax + B, where
A = -0.006 +/- 0.001 and
B = 1 +/- 0.04. I am sampling
x and want to change
chain sample so I can incorporate the uncertainty in my input parameters into the model uncertainty. Is there a way to do this? Thanks.
EDIT: Sorry all, it looks like my phrasing above was confusing. In pseudo-code, here’s what I want:
import numpy as np import pymc3 as pm # Dummy data Y = np.arange(0, 50) + np.random.randn(50) for sample in int(nburnin + nsamples): with pm.Model() as model: A = np.random.normal(-0.006, 0.001) B = np.random.normal(1.0, 0.04) y_true = pm.Data('y', Y) x = pm.Flat('x') y_syn = A*x + B #... augment likelihood to look at difference between y_true and y_syn ... trace = pm.sample(...)
Of course the above code wouldn’t work the way it is intended with PyMC3, but this demonstrates my point visually, I think.
I don’t want to use
pm.Normal('A', mu=-0.006, sigma=0.001 and
pm.Normal('B', mu=1, sigma=0.04) because (my understanding) is that this would sample those parameters to solve them in the MCMC. I just want the values and their uncertainties added into my model solving for x.