- This repository is used to run the Smoking History Generator (SHG) Policy Module and generate results for the TCP tool
- The TCP tool is a web-based user interface for a tobacco policy microsimulation model developed by the Cancer Intervention and Surveillance Modeling Network (CISNET) Lung consortium.
R version 3.2.3python version 2.7.12smoking-history-generator v.6.3.3shg-policy-module v0.1.2
The code in this repository is currently set up to run policy scenarios in parallel across 20 cores, with error and log files for each. Total run-time varies depending on the number of individuals generated per birth cohort (~1 min to simulate 200,000 individuals from a single birth cohort). There are 300 birth cohorts simulated per scenario, except for MLA which simulates 380 birth cohorts. When spread across 20 cores, this dramatically reduces the total amount of time needed to generate a full set of results. Because of the large number of files generated that need to be organized, the directory structure on your machine must be set up accordingly.
-
Create directories one level above this repository to store each set of results:
airlaws_results,taxes_results,tcexp_results,mla_resultsto store each policy's resultssource_datafor state-level and US datashg-policy-module-parallelas a copy ofshg-policy-module v0.1.2. To run the model across 20 cores, create 20 copies of shg-policy-module-parallel directory withpython wrapper.py.
-
Make necessary changes to the file paths referenced in these python and R scripts:
scenarios_airlaws.py,scenarios_taxes.py,scenarios_tcexp.py,scenarios_mla.py,tcptool_airlaws_data.py,tcptool_taxes_data.py,tcptool_tcexp_data.py,tcptool_mla_data.py, andcheck_files_for_errors.R
1) Choose one tobacco control policy to simulate results for
airlaws: implement and enforce smoke-free air laws up to three venues (1080 possible scenarios / runtime ~14 days)taxes: raise the price of a pack of cigarettes via taxes (635 possible scenarios)tcexp: increase the level of tobacco control program expenditures (280 possible scenarios)mla: raise the minimum age of legal access to tobacco (225 possible scenarios)
2) Run the policy module python policy_shg.py
- change
cohortsizeto reflect number of individuals simulated per birth cohort (500000 or 50 for test runs) - change
lastcohortto reflect the final birth cohort of individuals to simulate (2060 or 2100) - this step is the time-limiting step, so be sure your machine has sufficient cores to run all scenarios
- the
screencommand is helpful for avoiding interruptions to this command when you are away from the machine.
3) Generate national and state-level results under every scenario Rscript tcptool_airlaws_data.R
- be sure that
prevfilespoint to the correct directory where your scenarios from step 2 were generated - be sure that
mainDirpoints to a newsource_datadirectory where you want your final dataset to be located - change
cohortsizeto reflect number of individuals simulated per birth cohort (500000 or 200000) - smoking prevalence (results_w1_r1_b1_pacw0.00_pacr0.00_pacb0.00.csv)
- premature deaths avoided (deaths_w1_r1_b1_pacw0.00_pacr0.00_pacb0.00.csv)
- life-years gained (lyg_w1_r1_b1_pacw0.00_pacr0.00_pacb0.00.csv)
4) Check for errors in the results files Rscript check_files_for_errors.R
- missing policy scenarios
- missing rows of data
- negative sum of deaths avoided across all cohorts
- ratio of deaths avoided between men and women is greater than 2
5) Check for errors across the results files
- run
Rscript check_files_for_errors.Rto check results in thesource_datadirectory for missing policy scenarios, missing rows of data, negative sum of deaths avoided across all cohorts, and whether the ratio of deaths avoided between men and women is greater than 2
- Contact jamietam@umich.edu with questions
- Contact shg-distrib@lung.cisnet-group.org to request copies of the
smoking-history-generator v.6.3.3andshg-policy-module v0.1.2
-
airlaws:- workplaces? 0 (no) or 1 (yes)
- restaurants? 0 or 1
- bars? 0 or 1
- percent of workplaces already covered by smoke-free air laws? 0%, 25%, 50%, 75%, or 100%
- percent of restaurants already covered by smoke-free air laws? 0%, 25%, 50%, 75%, or 100%
- percent of bars already covered by smoke-free air laws? 0%, 25%, 50%, 75%, or 100%
-
taxes:- initial price per pack? $6.00, $6,50, $7.00, $7.50, $8.00, $8.50, $9.00, $9.50, $10.00, $10.50
- tax increase? $1.00, $1.50, $2.00, $2.50, $3.00, $3.50, $4.00, $4.50
-
tcexp:- existing level of expenditures (as % of CDC recommendations)? 0%, 10%, 20%, 30%, 40%, 50%, 60%, 70%, 80%, 90%, or 100%
- policy level of expenditures? 10%, 20%, 30%, 40%, 50%, 60%, 70%, 80%, 90%, or 100%
-
mla:- minimum age? 19, 21, or 25
- percent of population already covered by MLA 19? 0%, 25%, 50%, 75%, or 100%
- percent of population already covered by MLA 21? 0%, 25%, 50%, 75%, or 100%
- percent of population already covered by MLA 21? 0%, 25%, 50%, 75%, or 100%