Consistent models in DisMod-MR without many different types of data

In DisMod-II there was a requirement to have at least three different data types, corresponding to different parts of the compartmental model. DisMod-MR can run a compartmental model with only two, or even one data type, but this requires expert priors to fill in the gaps.

This document provides an example of how a model for Parkinson's Disease might look with different subsets of data types.


In [1]:
import matplotlib.pyplot as plt, numpy as np
import dismod_mr

In [2]:
models = {}
#iter=101; burn=0; thin=1  # use these settings to run faster
iter=10_000; burn=5_000; thin=5  # use these settings to make sure MCMC converges

Consistent fit with all data

Let's start with a consistent fit of the simulated PD data. This includes data on prevalence, incidence, and SMR, and the assumption that remission rate is zero. All together this counts as four different data types in the DisMod-II accounting.


In [3]:
model = dismod_mr.load('pd_sim_data/')
model.keep(areas=['GBR'], sexes=['female', 'total'])


kept 43 rows of data

In [4]:
model.setup_model()
%time model.fit(iter=iter, burn=burn, thin=thin)


using stored FE for beta_i_x_cv_ascertainment x_cv_ascertainment {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_i_x_cv_diagnostic_criteria x_cv_diagnostic_criteria {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_i_x_cv_representative x_cv_representative {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_i_x_sex x_sex {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_r_x_cv_ascertainment x_cv_ascertainment {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_r_x_cv_diagnostic_criteria x_cv_diagnostic_criteria {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_r_x_cv_representative x_cv_representative {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_r_x_sex x_sex {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_f_x_cv_ascertainment x_cv_ascertainment {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_f_x_cv_diagnostic_criteria x_cv_diagnostic_criteria {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_f_x_cv_representative x_cv_representative {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_f_x_sex x_sex {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
WARNING: all-cause mortality data not found, using m_all = .01
/ihme/homes/abie/.local/lib/python3.6/site-packages/pandas/core/indexing.py:480: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  self.obj[item] = s
using stored FE for beta_X_x_cv_ascertainment x_cv_ascertainment {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_X_x_cv_diagnostic_criteria x_cv_diagnostic_criteria {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_X_x_cv_representative x_cv_representative {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_X_x_sex x_sex {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
fitting submodels
/ihme/homes/abie/.local/lib/python3.6/site-packages/pandas/core/indexing.py:480: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  self.obj[item] = s
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 
fitting all stochs

finding step covariances
. . . . . . . . . . . . . . . . . . . . . . . . . 
sampling from posterior distribution

CPU times: user 26min 23s, sys: 2.23 s, total: 26min 25s
Wall time: 30min 22s

In [5]:
models['p, i, r, smr'] = model
model.plot()



In [6]:
models


Out[6]:
{'p, i, r, smr': <dismod_mr.data.ModelData at 0x7fc296336160>}

Consistent fit without incidence

Now let's do it again with the incidence removed. Since there is data on prevalence and SMR as well as the assumption that remission is zero, this counts as three data types, the minimum allowed for DisMod-II.


In [7]:
model = dismod_mr.load('pd_sim_data/')
model.keep(areas=['GBR'], sexes=['female', 'total'])

model.input_data = model.input_data[model.input_data.data_type != 'i']
print('kept %d rows' % len(model.input_data.index))


kept 43 rows of data
kept 39 rows

In [8]:
model.setup_model()
%time model.fit(iter=iter, burn=burn, thin=thin)


using stored FE for beta_i_x_cv_ascertainment x_cv_ascertainment {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_i_x_cv_diagnostic_criteria x_cv_diagnostic_criteria {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_i_x_cv_representative x_cv_representative {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_i_x_sex x_sex {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_r_x_cv_ascertainment x_cv_ascertainment {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_r_x_cv_diagnostic_criteria x_cv_diagnostic_criteria {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_r_x_cv_representative x_cv_representative {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_r_x_sex x_sex {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_f_x_cv_ascertainment x_cv_ascertainment {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_f_x_cv_diagnostic_criteria x_cv_diagnostic_criteria {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_f_x_cv_representative x_cv_representative {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_f_x_sex x_sex {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
WARNING: all-cause mortality data not found, using m_all = .01
using stored FE for beta_X_x_cv_ascertainment x_cv_ascertainment {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_X_x_cv_diagnostic_criteria x_cv_diagnostic_criteria {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_X_x_cv_representative x_cv_representative {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_X_x_sex x_sex {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
fitting submodels
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 
fitting all stochs

finding step covariances
. . . . . . . . . . . . . . . . . . . . . . . . . 
sampling from posterior distribution

CPU times: user 22min 16s, sys: 1.1 s, total: 22min 17s
Wall time: 22min 51s

In [9]:
models['p, r, smr'] = model
model.plot()


Consistent fit without incidence or mortality

This uses only prevalence data and the assumption that there is no remission, so it is not valid in DisMod-II. The Bayesian priors included by default in DisMod-MR make it possible, but the tradeoff between incidence and mortality is not informed by any data in this case.


In [10]:
model = dismod_mr.load('pd_sim_data/')
model.keep(areas=['GBR'], sexes=['female', 'total'])

model.input_data = model.input_data[model.input_data.data_type == 'p']
print('kept %d rows' % len(model.input_data.index))


kept 43 rows of data
kept 36 rows

In [11]:
model.setup_model()
%time model.fit(iter=iter, burn=burn, thin=thin)


using stored FE for beta_i_x_cv_ascertainment x_cv_ascertainment {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_i_x_cv_diagnostic_criteria x_cv_diagnostic_criteria {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_i_x_cv_representative x_cv_representative {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_i_x_sex x_sex {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_r_x_cv_ascertainment x_cv_ascertainment {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_r_x_cv_diagnostic_criteria x_cv_diagnostic_criteria {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_r_x_cv_representative x_cv_representative {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_r_x_sex x_sex {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_f_x_cv_ascertainment x_cv_ascertainment {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_f_x_cv_diagnostic_criteria x_cv_diagnostic_criteria {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_f_x_cv_representative x_cv_representative {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_f_x_sex x_sex {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
WARNING: all-cause mortality data not found, using m_all = .01
using stored FE for beta_X_x_cv_ascertainment x_cv_ascertainment {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_X_x_cv_diagnostic_criteria x_cv_diagnostic_criteria {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_X_x_cv_representative x_cv_representative {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_X_x_sex x_sex {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
fitting submodels
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 
fitting all stochs

finding step covariances
. . . . . . . . . . . . . . . . . . . . . . . . . 
sampling from posterior distribution

CPU times: user 17min 23s, sys: 1.8 s, total: 17min 25s
Wall time: 17min 24s

In [12]:
# the above took 20 minutes in 2013

In [13]:
models['p, r'] = model
model.plot()


Consistent fit with only prevalence

Now without assumption of zero remission, DisMod-MR is going for a very underconstrained problem, and relies on the priors heavily. However, the prevalence data is there, so the estimates of prevalence will not be changed much.


In [14]:
model = dismod_mr.load('pd_sim_data/')
model.keep(areas=['GBR'], sexes=['female', 'total'])

model.input_data = model.input_data[model.input_data.data_type == 'p']
print('kept %d rows' % len(model.input_data.index))

model.set_level_bounds('r', 0., 1.)
model.set_level_value('r', age_before=0., age_after=101., value=0)


kept 43 rows of data
kept 36 rows

In [15]:
model.setup_model()
%time model.fit(iter=iter, burn=burn, thin=thin)


using stored FE for beta_i_x_cv_ascertainment x_cv_ascertainment {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_i_x_cv_diagnostic_criteria x_cv_diagnostic_criteria {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_i_x_cv_representative x_cv_representative {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_i_x_sex x_sex {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_r_x_cv_ascertainment x_cv_ascertainment {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_r_x_cv_diagnostic_criteria x_cv_diagnostic_criteria {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_r_x_cv_representative x_cv_representative {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_r_x_sex x_sex {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_f_x_cv_ascertainment x_cv_ascertainment {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_f_x_cv_diagnostic_criteria x_cv_diagnostic_criteria {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_f_x_cv_representative x_cv_representative {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_f_x_sex x_sex {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
WARNING: all-cause mortality data not found, using m_all = .01
using stored FE for beta_X_x_cv_ascertainment x_cv_ascertainment {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_X_x_cv_diagnostic_criteria x_cv_diagnostic_criteria {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_X_x_cv_representative x_cv_representative {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_X_x_sex x_sex {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
fitting submodels
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 
fitting all stochs

finding step covariances
. . . . . . . . . . . . . . . . . . . . . . . . . 
sampling from posterior distribution

CPU times: user 17min 21s, sys: 2.21 s, total: 17min 24s
Wall time: 17min 23s

In [16]:
models['p'] = model
model.plot()


Comparison of alternative models

Let's compare the distributions for all of these now. You can see that the more data there is, the more concentrated the posterior distribution becomes.


In [17]:
for i, (label, model) in enumerate(models.items()):
    plt.hist(model.vars['p']['mu_age'].trace().mean(1), density=True, histtype='step',
         color=dismod_mr.plot.colors[i%4], linewidth=3, linestyle=['solid','dashed'][i//4],
         label=label)
plt.legend(loc=(1.1,.1))
plt.title('Posterior Distribution Comparison\nCrude Prevalence');



In [18]:
for i, (label, model) in enumerate(models.items()):
    plt.hist(model.vars['i']['mu_age'].trace().mean(1), density=True, histtype='step',
         color=dismod_mr.plot.colors[i%4], linewidth=3, linestyle=['solid','dashed'][i//4],
         label=label)
plt.legend(loc=(1.1,.1))
plt.title('Posterior Distribution Comparison\nCrude Incidence');


Consistent fit without prevalence

The really challenging case is without any prevalence data. DisMod-MR will go for it, but there will be a lot of uncertainty.


In [19]:
model = dismod_mr.load('pd_sim_data/')
model.keep(areas=['GBR'], sexes=['female', 'total'])

model.input_data = model.input_data[model.input_data.data_type != 'p']
print('kept %d rows' % len(model.input_data.index))

model.setup_model()


kept 43 rows of data
kept 7 rows
using stored FE for beta_i_x_cv_ascertainment x_cv_ascertainment {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_i_x_cv_diagnostic_criteria x_cv_diagnostic_criteria {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_i_x_cv_representative x_cv_representative {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_i_x_sex x_sex {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_r_x_cv_ascertainment x_cv_ascertainment {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_r_x_cv_diagnostic_criteria x_cv_diagnostic_criteria {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_r_x_cv_representative x_cv_representative {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_r_x_sex x_sex {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_f_x_cv_ascertainment x_cv_ascertainment {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_f_x_cv_diagnostic_criteria x_cv_diagnostic_criteria {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_f_x_cv_representative x_cv_representative {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_f_x_sex x_sex {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
WARNING: all-cause mortality data not found, using m_all = .01
using stored FE for beta_X_x_cv_ascertainment x_cv_ascertainment {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_X_x_cv_diagnostic_criteria x_cv_diagnostic_criteria {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_X_x_cv_representative x_cv_representative {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_X_x_sex x_sex {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}

In [20]:
%time model.fit(iter=iter, burn=burn, thin=thin)


fitting submodels
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 
fitting all stochs

finding step covariances
. . . . . . . . . . . . . . . . . . . . . . . . . 
sampling from posterior distribution

CPU times: user 17min 37s, sys: 1.55 s, total: 17min 39s
Wall time: 17min 37s

In [21]:
models['i, r, smr'] = model
model.plot()


Consistent fit with incidence only

DisMod-MR it will even go for it with only incidence. But that is not ideal...


In [22]:
model = dismod_mr.load('pd_sim_data/')
model.keep(areas=['GBR'], sexes=['female', 'total'])

model.input_data = model.input_data[model.input_data.data_type == 'i']
print('kept %d rows' % len(model.input_data.index))
model.set_level_bounds('r', 0., 1.)

model.setup_model()


kept 43 rows of data
kept 4 rows
using stored FE for beta_i_x_cv_ascertainment x_cv_ascertainment {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_i_x_cv_diagnostic_criteria x_cv_diagnostic_criteria {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_i_x_cv_representative x_cv_representative {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_i_x_sex x_sex {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_r_x_cv_ascertainment x_cv_ascertainment {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_r_x_cv_diagnostic_criteria x_cv_diagnostic_criteria {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_r_x_cv_representative x_cv_representative {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_r_x_sex x_sex {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_f_x_cv_ascertainment x_cv_ascertainment {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_f_x_cv_diagnostic_criteria x_cv_diagnostic_criteria {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_f_x_cv_representative x_cv_representative {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_f_x_sex x_sex {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
WARNING: all-cause mortality data not found, using m_all = .01
using stored FE for beta_X_x_cv_ascertainment x_cv_ascertainment {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_X_x_cv_diagnostic_criteria x_cv_diagnostic_criteria {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_X_x_cv_representative x_cv_representative {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_X_x_sex x_sex {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}

In [23]:
%time model.fit(iter=iter, burn=burn, thin=thin)


fitting submodels
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 
fitting all stochs

finding step covariances
Cannot calculate AIC: float division by zero
. Cannot calculate AIC: float division by zero
. Cannot calculate AIC: float division by zero
. Cannot calculate AIC: float division by zero
. Cannot calculate AIC: float division by zero
. Cannot calculate AIC: float division by zero
. . . . . . . . . . . . . . . . . . . . 
sampling from posterior distribution

CPU times: user 12min 51s, sys: 2.12 s, total: 12min 53s
Wall time: 12min 51s

In [24]:
models['i'] = model
model.plot()


Consistent fit without prevalence or incidence

DisMod-MR is not magic, however. Without prevalence or incidence, it will not know how much PD there is!


In [25]:
model = dismod_mr.load('pd_sim_data/')
model.keep(areas=['GBR'], sexes=['female', 'total'])

model.input_data = model.input_data[model.input_data.data_type == 'smr']
print('kept %d rows' % len(model.input_data.index))

model.setup_model()


kept 43 rows of data
kept 3 rows
using stored FE for beta_i_x_cv_ascertainment x_cv_ascertainment {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_i_x_cv_diagnostic_criteria x_cv_diagnostic_criteria {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_i_x_cv_representative x_cv_representative {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_i_x_sex x_sex {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_r_x_cv_ascertainment x_cv_ascertainment {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_r_x_cv_diagnostic_criteria x_cv_diagnostic_criteria {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_r_x_cv_representative x_cv_representative {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_r_x_sex x_sex {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_f_x_cv_ascertainment x_cv_ascertainment {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_f_x_cv_diagnostic_criteria x_cv_diagnostic_criteria {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_f_x_cv_representative x_cv_representative {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_f_x_sex x_sex {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
WARNING: all-cause mortality data not found, using m_all = .01
using stored FE for beta_X_x_cv_ascertainment x_cv_ascertainment {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_X_x_cv_diagnostic_criteria x_cv_diagnostic_criteria {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_X_x_cv_representative x_cv_representative {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}
using stored FE for beta_X_x_sex x_sex {'mu': 0, 'dist': 'Normal', 'sigma': 0.0001}

In [26]:
%time model.fit(iter=iter, burn=burn, thin=thin)


fitting submodels
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 
fitting all stochs

finding step covariances
. . . . . . . . . . . . . . . . . . . . . . . . . 
sampling from posterior distribution

CPU times: user 13min 51s, sys: 3.42 s, total: 13min 55s
Wall time: 13min 53s

In [27]:
models['r, smr'] = model
model.plot()



In [28]:
for i, label in enumerate(['p', 'i, r, smr', 'i', 'r, smr']):
    try:
        plt.hist(models[label].vars['p']['mu_age'].trace().mean(1), density=False, histtype='step',
             color=dismod_mr.plot.colors[i%4], linewidth=3, linestyle=['solid','dashed'][i//4],
             label=label)
    except AttributeError as e:
        print(e)
plt.legend(loc=(1.1,.1))
plt.title('Posterior Distribution Comparison\nCrude Prevalence')
plt.axis(xmin=-.001);



In [29]:
!date


Tue Jul 23 16:08:19 PDT 2019