Esempio n. 1
0
def model_outcomes(C0, P, D, t_steps, pops, verbose=2):

    y = steps(P, C0, t_steps)

    # M stores model outcomes to be calibrated
    data_vars = ['population_size', 'mortality_per_month', 'mortality_rate', 'percent_stunted']
    M = dict()
    for i in data_vars:
        M[i] = dict()

    M['population_size']['fertile_women'] = sum(y['fertile_women'][t_steps])
    M['mortality_per_month']['fertile_women'] = sum(y['fertile_women'][t_steps]) * P['mortality']['fertile_women']
    M['percent_stunted']['fertile_women'] = y['fertile_women'][t_steps][1] / sum(y['fertile_women'][t_steps])
    M['population_size']['0-1'] = sum(y['0-1'][t_steps])
    M['mortality_per_month']['0-1'] = y['0-1'][t_steps][0] * P['mortality']['0-1']['non-stunted'] + y['0-1'][t_steps][1] * P['mortality']['0-1']['stunted']
    M['percent_stunted']['0-1'] = y['0-1'][t_steps][1] / sum(y['0-1'][t_steps])
    M['population_size']['1-6'] = sum(y['1-6'][t_steps])
    M['mortality_per_month']['1-6'] = y['1-6'][t_steps][0] * P['mortality']['1-6']['non-stunted'] + y['1-6'][t_steps][1] * P['mortality']['1-6']['stunted']
    M['percent_stunted']['1-6'] = y['1-6'][t_steps][1] / sum(y['1-6'][t_steps])
    M['population_size']['6-12'] = sum(y['6-12'][t_steps])
    M['mortality_per_month']['6-12'] = y['6-12'][t_steps][0] * P['mortality']['6-12']['non-stunted'] + y['6-12'][t_steps][1] * P['mortality']['6-12']['stunted']
    M['percent_stunted']['6-12'] = y['6-12'][t_steps][1] / sum(y['6-12'][t_steps])
    M['population_size']['12-24'] = sum(y['12-24'][t_steps])
    M['mortality_per_month']['12-24'] = y['12-24'][t_steps][0] * P['mortality']['12-24']['non-stunted'] + y['12-24'][t_steps][1] * P['mortality']['12-24']['stunted']
    M['percent_stunted']['12-24'] = y['12-24'][t_steps][1] / sum(y['12-24'][t_steps])
    M['population_size']['24-72'] = sum(y['24-72'][t_steps])
    M['mortality_per_month']['24-72'] = y['24-72'][t_steps][0] * P['mortality']['24-72']['non-stunted'] + y['24-72'][t_steps][1] * P['mortality']['24-72']['stunted']
    M['percent_stunted']['24-72'] = y['24-72'][t_steps][1] / sum(y['24-72'][t_steps])

    return M
Esempio n. 2
0
def model_outcomes(C0, P, D, t_steps, pops, verbose=2):

    y = steps(P, C0, t_steps)

    # M stores model outcomes to be calibrated
    data_vars = [
        'population_size', 'mortality_per_month', 'mortality_rate',
        'percent_stunted'
    ]
    M = dict()
    for i in data_vars:
        M[i] = dict()

    M['population_size']['fertile_women'] = sum(y['fertile_women'][t_steps])
    M['mortality_per_month']['fertile_women'] = sum(
        y['fertile_women'][t_steps]) * P['mortality']['fertile_women']
    M['percent_stunted']['fertile_women'] = y['fertile_women'][t_steps][
        1] / sum(y['fertile_women'][t_steps])
    M['population_size']['0-1'] = sum(y['0-1'][t_steps])
    M['mortality_per_month']['0-1'] = y['0-1'][t_steps][0] * P['mortality'][
        '0-1']['non-stunted'] + y['0-1'][t_steps][1] * P['mortality']['0-1'][
            'stunted']
    M['percent_stunted']['0-1'] = y['0-1'][t_steps][1] / sum(y['0-1'][t_steps])
    M['population_size']['1-6'] = sum(y['1-6'][t_steps])
    M['mortality_per_month']['1-6'] = y['1-6'][t_steps][0] * P['mortality'][
        '1-6']['non-stunted'] + y['1-6'][t_steps][1] * P['mortality']['1-6'][
            'stunted']
    M['percent_stunted']['1-6'] = y['1-6'][t_steps][1] / sum(y['1-6'][t_steps])
    M['population_size']['6-12'] = sum(y['6-12'][t_steps])
    M['mortality_per_month']['6-12'] = y['6-12'][t_steps][0] * P['mortality'][
        '6-12']['non-stunted'] + y['6-12'][t_steps][1] * P['mortality'][
            '6-12']['stunted']
    M['percent_stunted']['6-12'] = y['6-12'][t_steps][1] / sum(
        y['6-12'][t_steps])
    M['population_size']['12-24'] = sum(y['12-24'][t_steps])
    M['mortality_per_month']['12-24'] = y['12-24'][t_steps][0] * P[
        'mortality']['12-24']['non-stunted'] + y['12-24'][t_steps][1] * P[
            'mortality']['12-24']['stunted']
    M['percent_stunted']['12-24'] = y['12-24'][t_steps][1] / sum(
        y['12-24'][t_steps])
    M['population_size']['24-72'] = sum(y['24-72'][t_steps])
    M['mortality_per_month']['24-72'] = y['24-72'][t_steps][0] * P[
        'mortality']['24-72']['non-stunted'] + y['24-72'][t_steps][1] * P[
            'mortality']['24-72']['stunted']
    M['percent_stunted']['24-72'] = y['24-72'][t_steps][1] / sum(
        y['24-72'][t_steps])

    return M
Esempio n. 3
0
import numpy as np
import pylab as pl
from model import steps
from likelihood import lnlike, model_outcomes
from inputs import get_data, get_params, get_initial_conditions
from mcmc import mcmc

pops = ['fertile_women', '0-1', '1-6', '6-12', '12-24', '24-72']
D = get_data()
P = get_params()
C0 = get_initial_conditions()

t_steps = 1000  # model run time (months)

# Run the model
y = steps(P, C0, t_steps)

LL = lnlike(C0, P, D, t_steps, pops)

# Parameters to calibrate
meta_prefit = dict()
meta_prefit['mortality, 0-1, non-stunted'] = P['mortality']['0-1'][
    'non-stunted']
meta_prefit['mortality, 0-1, stunted'] = P['mortality']['0-1']['stunted']
meta_prefit['mortality, 1-6, non-stunted'] = P['mortality']['1-6'][
    'non-stunted']
meta_prefit['mortality, 1-6, stunted'] = P['mortality']['1-6']['stunted']
meta_prefit['mortality, 6-12, non-stunted'] = P['mortality']['6-12'][
    'non-stunted']
meta_prefit['mortality, 6-12, stunted'] = P['mortality']['6-12']['stunted']
meta_prefit['mortality, 12-24, non-stunted'] = P['mortality']['12-24'][
Esempio n. 4
0
import numpy as np
import pylab as pl
from model import steps
from likelihood import lnlike, model_outcomes
from inputs import get_data, get_params, get_initial_conditions
from mcmc import mcmc

pops = ['fertile_women', '0-1', '1-6', '6-12', '12-24', '24-72']
D = get_data()
P = get_params()
C0 = get_initial_conditions()

t_steps = 1000  # model run time (months)

# Run the model
y = steps(P, C0, t_steps)

LL = lnlike(C0, P, D, t_steps, pops)


# Parameters to calibrate
meta_prefit = dict()
meta_prefit['mortality, 0-1, non-stunted'] = P['mortality']['0-1']['non-stunted']
meta_prefit['mortality, 0-1, stunted'] = P['mortality']['0-1']['stunted']
meta_prefit['mortality, 1-6, non-stunted'] = P['mortality']['1-6']['non-stunted']
meta_prefit['mortality, 1-6, stunted'] = P['mortality']['1-6']['stunted']
meta_prefit['mortality, 6-12, non-stunted'] = P['mortality']['6-12']['non-stunted']
meta_prefit['mortality, 6-12, stunted'] = P['mortality']['6-12']['stunted']
meta_prefit['mortality, 12-24, non-stunted'] = P['mortality']['12-24']['non-stunted']
meta_prefit['mortality, 12-24, stunted'] = P['mortality']['12-24']['stunted']
meta_prefit['mortality, 24-72, non-stunted'] = P['mortality']['24-72']['non-stunted']