Hello, all. So I was messing around with a very simple idea, to use Bayesian statistics to estimate an average . The way I went about doing this was simply fitting a pm.Normal()
to a single vector of data, and using the estimated mu
and sigma
to get the distribution of the average.
A quick minimum working example is below,
input_data = [2,3,2,4,2.2,1.2,6.6,1,2.79,3.001]
with pm.Model() as weekly_rate_model:
# Priors
mu_sigma_offset = pm.HalfNormal('mu_sigma_offset', sd=1)
mu_sigma = pm.Deterministic('mu_sigma', mu_sigma_offset * 50)
mu = pm.Normal('mu', mu = np.mean(input_data), sigma = mu_sigma)
sigma = pm.HalfNormal('sigma', sd = 1000) # Using a wide distribution
# Likelihood
weekly_rate = pm.Normal('weekly_rate', mu = mu, sigma = sigma,
observed = input_data)
trace = pm.sample(cores=4, draws=2000, tune=2000)
So for the above, I get a mu
and a sigma
for a weekly rate, but how would I go about scaling the mu
and sigma
up for another time period, let’s say, a bi-weekly rate, or a 2 monthly rate (so 8 weeks)?
Now, I know a Poisson regression would potentially solve this problem for me perfectly, but in this particular case, is there a general Bayesian way to scale up one set of estimated parameters for a time period, to another period?
Thank you greatly in advance for any of your insight.