Not sure if I am doing something silly or pymc3 has a bug, but trying to fit T distribution to normal I get number of degrees of freedom (0.18 to 0.25, I'd expect something high, 4-5 at least). Of course I am getting the same error if I try T distribution with reasonable number of degrees of freedom, like 3 or 5.
import pymc3 as pm
Nsample = 200000
tst = np.random.normal(loc = 1e4, scale = 5e4, size = 250)
with pm.Model() as m:
mean = pm.Normal('mean',mu=0,sd = 1e5)
sigma = pm.Flat('sigma') # I tried uniform, gamma, exponential
df = pm.Flat("df") # the same
v = pm.T("pl",nu=df,mu = mean, lam = 1.0/sigma, observed = tst)
start = {'df':5,'mean': 1e4, 'sigma':5e4} #start = pm.find_MAP()
step = pm.Metropolis()
trace = pm.sample(Nsample, step,start=start, progressbar=True)
pm.traceplot(trace[100000:],vars = ['df', 'sigma', 'mean']);
Could you suggest some fix (changing priors, sampling method )?.