Created
March 3, 2016 21:47
-
-
Save jiaweih/8c28073d7b9a58549afb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"> It is useful to have a single measure of exposure for each risk factor whether the risk is dichotomous, polytomous or continuous. This allows examination of trends in risk factors over time. An age-standardized version allows for comparison between places that highlights differences in exposure" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"### Our general form for this measure for a risk-outcome pair" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"$$ SE_{joasct} = \\frac{\\int_{x=l}^{\\mu}RR_{joas}(x)P_{jasct}(x)dx - 1}{RR_{joas}(max) - 1} $$" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"> We average the values across different outcomes. Because the relative shape of the relative risk curves across outcomes are generally consistent, the variation in the summary exposure measure across outcomes for a risk is relatively small ." | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"### Generate a single summary measure of exposure" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"$$ SE_{jasct} = \\frac{\\sum_{o=1}^wSE_{joasct}}{w} $$" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"# Preparing data" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"### $RR_{max}$ (relative risk at the maximum level of exposure)" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"Source: /home/j/temp/stan/sev_draw/(exp_2015_06_18 | exp_2015_08_03)/" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"### RR (relative risk)" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"Source: Mollie's getting data function" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"### P (exposure)" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"Source: Mollie's getting data function" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"### Parameters " | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"> * inv_exp: flag indicating whether risk is beneficial; 1 indicates beneficial, 0 indicates detrimental\n", | |
"* rr_scalar: scalar to standardize units of relative risk and exposure\n", | |
"* integ_min: lower level of integration\n", | |
"* integ_max: upper level of integration\n", | |
"* tmrel_min: minimum TMREL \n", | |
"* tmrel_max: maximum TMREL" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"Source: /home/j/temp/stan/GBD_2015/risks/risk_variables.xlsx (ask Stan if he updates them, he is still working on development)" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"# Calculating" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"### Getting parameters $( \\mu(p), \\sigma(p), RR_{mean} )$" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"get_params(df_exp,df_rr,acause,age_group_id,location_id,year,sex)" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"### Getting TMREL (Theoretical Minimum Risk Exposure Level)" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"get_tmrel(risk,age,sex,iso3,tmrel_min,tmrel_max)" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"> If risk is among diet_pufa, metab_bmd, nutrition_iron, TMREL data is stored under /snfs3/WORK/05_risk/02_models/02_results; otherwise, it the mean of minimum TMREL and maximum TMREL" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"### Calculating exposure " | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"> If the distribution of exposure conforms to log normal distribution:\n", | |
"\n", | |
"> Function: /homes/jiaweihe/fbd/sev/cont_sev/draws_cont_sev/testlib.so\n", | |
"\n", | |
"> Relevant formula: https://en.wikipedia.org/wiki/Log-normal_distribution" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"$$ \\mu = ln(\\frac{\\mu(p)}{\\sqrt{1+\\frac{\\sigma^2(p)}{\\mu^2(P)}}}) $$" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"$$\\sigma = \\sqrt{ln(1 + \\frac{\\sigma^2(p)}{\\mu^2(p)})}$$" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"$$P(x) = \\frac{1}{x\\sigma\\sqrt{2\\pi}}e^{-{\\frac{(lnx - \\mu)^2}{2\\sigma^2}}} $$" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"> If the distribution of exposure conforms to normal distribution:" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"$$P(x) = \\frac{1}{\\sigma(p)\\sqrt{2\\pi}}e^{-\\frac{(x - \\mu^2(p)}{2\\sigma^2(p)}}$$" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"### Calculating relative risk" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"> If the risk factor is beneficial, the relative risk (RR) can be calculated by:" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"$$ RR(x) = RR_{mean}^{TMREL - x} $$ " | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"> If the risk factor is detrimental, the relative risk (RR) can be calculated by:" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"$$ RR(x) = RR_{mean}^{x - TMREL} $$ " | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"> If calculate relative risk is greater than maximum relative risk, then set relative risk as maximum relative risk" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"$$RR(x) = RR_{max}$$" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"> If exposure level is greater than TMREL, then set relative risk as 1" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"$$RR(x) = 1$$" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"### Getting SEV for a risk-outcome pair" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"$$ SE_{joasct} = \\frac{\\int_{x=l}^{\\mu}RR_{joas}(x)P_{jasct}(x)dx - 1}{RR_{joas}(max) - 1} $$" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"### Getting SEV for a risk" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"$$ SE_{jasct} = \\frac{\\sum_{o=1}^wSE_{joasct}}{w} $$" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 2", | |
"language": "python", | |
"name": "python2" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 2 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython2", | |
"version": "2.7.11" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 0 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment