In [1]:
import bayleaf as bf
import numpy as np
import pymc3 as pm
import matplotlib.pylab as plt
%matplotlib inline
In [ ]:
In [ ]:
In [ ]:
In [2]:
N=500; beta = -0.6; rateC = 0.0001;
maxtime = 200
lam =.11; rho = .6
df_sim = bf.simulate.sim_Weibull(N=N, lam =lam, rho = rho, beta = beta, rateC = rateC, maxtime=maxtime)
df_sim.head()
Out[2]:
In [6]:
plt.hist(df_sim.time.values)
Out[6]:
In [ ]:
### For now, we will work within the pm.Model() environment. We will embed this at a later date
In [3]:
with pm.Model() as mod:
bf.ParSurv.from_formula(formula='([time],[event])~x', data=df_sim, family="weibull")
step = pm.NUTS(target_accept=.99)
trace = pm.sample(10000,step=step,tune =5000)
In [4]:
pm.traceplot(trace[5000:])
Out[4]:
In [ ]: