***=======================================================* * FEM * Mar 2008 * Sep 14, 2008 - Record spousal AIME, birth year, claiming year (in EconGen.ado) * Dec 26, 2008 - for "obese_r" and "invobese_r", reduce the prevalence of obesity after age 51 * April 2008 - Renamed and refactored as run_fem.do. Reads scenario info from an excel file ***=======================================================* noi di _column(10) "************************************" noi di _column(10) "* ------- Starting FEM --------- *" noi di _column(10) "************************************" noi di noi di "Run Date: " c(current_date) " " c(current_time) * Clear anything thats already in memory clear all cap clear mata cap clear programs cap clear ado discard est clear * Setup some environmental settings set more off set mem 500m * Define Directories global prepath "/zeno/a/FEM/FEM_1.0" global workdir "$prepath/Code" global indata "$prepath/Input_yh" global indata2 "$prepath/Indata_yh" global netindata "/homer/c/Retire/FEM/rdata" * global netindata "$prepath/Indata_yh" global ster "$prepath/Estimates" adopath + "$workdir" cd "$workdir" * Load Subroutines qui run scenario_run.ado qui run status_update.ado qui run keepstats.ado qui run EconGen.ado qui run GovExp.ado qui run MedCosts.ado qui run intervention.ado qui run initial_intervention.ado * Load assumptions such as mortality rates and immigration rates qui do load_assumptions.do * Setup variables qui do setup_variables.do * Setup variables for summary data qui do setup_summary_vars.do noi di "Number of summary variables: $n_sumvars" * Load programs for running interventions qui do load_interventions.do * Load programs for running initial interventions qui do load_init_interventions.do ***=======================================================* * Key assumpations: whether to include smoking in the mortality equation: 1 = yes, 0 = No * ????????????? Move to scenario steup excel file ???????????????????? ***=======================================================* global smk_mort = 1 * Open the scenarios excel file and check how many scenarios there are * odbc load, dsn("Excel Files;DBQ=$prepath//Scenarios.xls") table("sheet1$") clear * Open as CSV file insheet using $prepath/Scenarios.csv, comma names clear local nscenarios = _N noi di "Total Scenarios to Run : `nscenarios'" noi di * Parameters to load that will be treated as global macro variables local globals = "scenario_name output_dir nreps simutype base_cohort_name new_cohort_model init_interventions interventions use_obese_baseline obese_baseline cost_noise detailed_output" * Parameters to load that will be treated as numerical scalars local scalars = "startyr stpyr endyr medicare_elig_age asmoken aobese ahibpe adiabe init_intervene_diab_rd init_intervene_obs_rd" * Run each scenario forvalues scenario_i = 1/`nscenarios' { noi di "****** Running Scenario `scenario_i'******" * Open the scenarios excel file and check how many scenarios there are * odbc load, dsn("Excel Files;DBQ=$prepath//Scenarios.xls") table("sheet1$") clear * Open as CSV file insheet using $prepath/Scenarios.csv, comma names clear * Load the parameters for that scenario into the corresponding parameter (scalar or global) foreach v in `globals' { global `v' = `v' in `scenario_i' } foreach v in `scalars' { scalar `v' = `v' in `scenario_i' } clear * Print out the loaded parameters noi di "Parameters:" foreach v in `globals' { noi di _column(10) "`v'" _column(30) " = $`v'" } foreach v in `scalars' { noi di _column(10) "`v'" _column(30) " = " `v' } * Fix parameter names to be compatible with existing FEM code global outdata = "$output_dir" global startyr = startyr global stpyear = stpyr global endyear = endyr global steps = 2 * Load in estimates. Note that we read in estimates here because the location of the estimates * is defined in the setup scenario step. The validation mode uses different estimates than simulation mode do load_estimates.do * Matrix to store summary statistics after each simulation matrix newmat = J(1,$n_sumvars,.) matrix colnames newmat = year $sumvars * Run the scenario! scenario_run , simutp($simutype) stpyr($stpyear) /// endyr($endyear) ttlrep($nreps) base_cohort($base_cohort_name) new_cohort($new_cohort_model) }