1
$\begingroup$

I am doing bayesian inference on normal data, and wonder how robust are the results with respects to some assumptions and potential mistakes.

Specifically, for simplicity I want to assume that variance is known. it isn't really, but roughly know where it is (e.g. about 90% of the cases it is between 0.05 and 0.07 (the mean ranges from -0.6 to 0.6 roughly). I am only interested in learning about the mean.

how bad it would be to assume that the sd is 0.06 (or 0.07 or any other value). how it would affect my estimations of the mean? will it bias it? will it under/over estimate the variance of the posterior of the mean?

any comments - both specific to the case above, or more general about the robustness of bayesian normal inference would be much appreciated.

$\endgroup$

1 Answer 1

2
$\begingroup$

If you are doing Bayesian inference, wouldn't it make more sense to infer the variance as well?

Let's first try the case when the variance (or equivalently, standard deviation) is specified.

Generate the data:

import numpy as np
import pymc3 as pm

true_mu = 1.0
true_sd = 0.05
n_obs = 20

np.random.seed(1234)
data = np.random.normal(loc=true_mu, scale=true_sd, size=n_obs)

Case 1, when the standard deviation is specified.

Let's assume std=0.1

assumed_sd = 0.1

with pm.Model() as model:
    mu = pm.Uniform('mu', lower=-10, upper=10) 
    center = pm.Normal('obs', mu=mu, sd=assumed_sd, observed=data)
    start_MAP = pm.find_MAP()
    trace = pm.sample(3000, start=start_MAP, step=pm.NUTS())
    trace = trace[1000:] 

enter image description here

Case 2, infer both mean and the standard deviation

with pm.Model() as model:
    mu = pm.Uniform('mu', lower=-10, upper=10) 
    sd = pm.HalfCauchy('sigma', beta=10, testval=1.0)   
    center = pm.Normal('obs', mu=mu, sd=sd, observed=data)
    start_MAP = pm.find_MAP()
    trace = pm.sample(3000 start=start_MAP, step=pm.NUTS())
    trace = trace[1000:]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.