** NOTE TO USER: ** Depending on the Stata version you are using, mind you that ** various statistics commands below extend beyond more than one line of code. ** To ensure that Stata will read multiple lines of code as pertining to the same ** command, users may have to add /// at the end each line to ensure that ** the subsequent line will be read as contiguous with the previous one. ** Import csv file ** import delimited supplemental_material_data_original, numericcols(2/30) ** Define data as time-series (panel data) encode country, gen(countrynum) encode region22, gen(regionnum) tsset countrynum year, yearly sort countrynum year ** Check duplicates duplicates report country year duplicates list country year * Drop countries drop if year < 1949 drop if v2x_polyarchy == . drop if v2x_libdem == . drop if v2x_partipdem == . // this is equivalent to listwise deletion * Create ID gen id = _n * Count # of countries based on Democracy score tabulate year * Create a tag for summary egen pickone_country = tag(country) egen pickone_region22 = tag(region22) egen pickone_year = tag(year) ******** Create Variables ************ * comprehensive democracy score (see V-dem project) gen dem = v2x_polyarchy*v2x_libdem*v2x_partipdem summarize dem * Rescaling democracy summarize dem gen dem_100 = ((dem - r(min)) / (r(max) - r(min)))*100 summarize dem_100 // Don't forget to add constant 1 before log-transform later * Center Year at 1994 (N = 170) gen year1994 = year - 1994 summarize year1994 * Center Year at 1949 (N = 145) gen year1949 = year - 1949 summarize year1949 * Center Year at the mean for a quadratic model summarize year gen year_cent = year - r(mean) summarize year_cent * Center Quadratic Year at the mean gen year_quad_cent = year_cent*year_cent summarize year_quad_cent cor year_cent year_quad_cent plot year_cent year_quad_cent // no correlation * Compare imputed GDP & Population with unimputed ones * Show correlations between V-dem population & GDP with GDP & Population by World Bank summarize e_migdppc gdp e_mipopula pop pwcorr e_migdppc gdp e_mipopula pop, sig obs plot gdp e_migdppc plot pop e_mipopula * In the current data, it is already imputed as "pop_imp" & "gdp_imp" * Compute Pathogen Stress Index (national population expressed in 100,000 unit) gen ps7 = who7/(pop_imp/100000) gen ps6 = who6/(pop_imp/100000) // Excluding tuburculosis * Compute Natural Disaster Casualties gen ndc = disasterall/(pop_imp/100000) * Express GDP in 1,000 unit gen gdp_1000 = gdp_imp/1000 summarize gdp_1000 ** Count country N of each variable egen dem_100_N = count(dem_100), by (country) egen gdp_N = count(gdp_1000), by (country) egen ps7_N = count(ps7), by (country) egen cd_N = count(cd), by (country) egen ndc_N = count(ndc), by (country) ** Count country N of each variable by year egen dem_100_N_y = count(dem_100), by (year) egen gdp_N_y = count(gdp_1000), by (year) egen ps7_N_y = count(ps7), by (year) egen cd_N_y = count(cd), by (year) egen ndc_N_y = count(ndc), by (year) * Count N of countries by regions egen region22_N = count(country) if pickone_country ==1, by (region22) sort region22 list region22 region22_N country if pickone_country==1 ****************************** *** Transforming Variables *** ****************************** ** Log-transform (add 1 as a constant) * Democracy gen dem_100_1 = dem_100 + 1 summarize dem_100_1 gen log_dem_100 = ln(dem_100_1) summarize log_dem_100 * GDP gen gdp_1000_1 = gdp_1000 + 1 summarize gdp_1000_1 gen log_gdp = ln(gdp_1000_1) summarize log_gdp * Pathogens gen ps7_1 = ps7 + 1 summarize ps7_1 gen log_ps7 = ln(ps7_1) summarize log_ps7 * 6 Pathogens gen ps6_1 = ps6 + 1 summarize ps6_1 gen log_ps6 = ln(ps6_1) summarize log_ps6 * Climate gen cd_1 = cd + 1 summarize cd_1 gen log_cd = ln(cd_1) summarize log_cd * Disasters gen ndc_1 = ndc + 1 summarize ndc_1 gen log_ndc = ln(ndc_1) summarize log_ndc hist log_dem_100 hist log_dem_alt_100 hist log_gdp hist log_ps7 hist log_ps6 hist log_cd hist log_ndc ***************************************************** *** Group-mean centering predictors by country *** *** see (Bell & Jones, 2015; Curran & Bauer, 2011)*** ***************************************************** *** Compute country-specific means egen cmean_log_gdp = mean(log_gdp), by(country) egen cmean_log_ps7 = mean(log_ps7), by(country) egen cmean_log_ps6 = mean(log_ps6), by(country) egen cmean_log_cd = mean(log_cd), by(country) egen cmean_log_ndc = mean(log_ndc), by(country) hist cmean_log_gdp hist cmean_log_ps7 hist cmean_log_ps6 hist cmean_log_cd hist cmean_log_ndc ** Group-mean centering to create within-country variables gen log_withincgdp = log_gdp - cmean_log_gdp gen log_withincps7 = log_ps7 - cmean_log_ps7 gen log_withincps6 = log_ps6 - cmean_log_ps6 gen log_withinccd = log_cd - cmean_log_cd gen log_withincndc = log_ndc - cmean_log_ndc hist log_withincgdp hist log_withincps7 hist log_withincps6 hist log_withinccd hist log_withincndc * A quick way to check if group-mean centering worked --> See if every country has the mean of zero graph box log_withincgdp, over(country) graph box log_withincps7, over(country) graph box log_withincps6, over(country) graph box log_withinccd, over(country) graph box log_withincndc, over(country) ** GRAND-mean centering at the level-2 (this is for cross-level interaction) * Compute the mean of the country means egen mean_cmean_log_gdp = mean(cmean_log_gdp) egen mean_cmean_log_ps7 = mean(cmean_log_ps7) egen mean_cmean_log_ps6 = mean(cmean_log_ps6) egen mean_cmean_log_cd = mean(cmean_log_cd) egen mean_cmean_log_ndc = mean(cmean_log_ndc) egen mean_dem_100_N = mean(dem_100_N) // # of years included as a control * GRAND-mean centering gen gmc_log_cmeangdp = cmean_log_gdp - mean_cmean_log_gdp gen gmc_log_cmeanps7 = cmean_log_ps7 - mean_cmean_log_ps7 gen gmc_log_cmeanps6 = cmean_log_ps6 - mean_cmean_log_ps6 gen gmc_log_cmeancd = cmean_log_cd - mean_cmean_log_cd gen gmc_log_cmeanndc = cmean_log_ndc - mean_cmean_log_ndc gen gmc_dem_100_N = dem_100_N - mean_dem_100_N * Also compute standard deviation at level-2 egen sd_cmean_log_gdp = sd(cmean_log_gdp) egen sd_cmean_log_ps7 = sd(cmean_log_ps7) egen sd_cmean_log_ps6 = sd(cmean_log_ps6) egen sd_cmean_log_cd = sd(cmean_log_cd) egen sd_cmean_log_ndc = sd(cmean_log_ndc) summarize gmc_log_cmeangdp gmc_log_cmeanps7 gmc_log_cmeanps6 gmc_log_cmeancd gmc_log_cmeanndc summarize sd_cmean_log_gdp sd_cmean_log_ps7 sd_cmean_log_ps6 sd_cmean_log_cd sd_cmean_log_ndc ** Level-2 summary with country rankings * Table of country-level GDP egen c_rank_gdp = rank(gmc_log_cmeangdp) if pickone_country==1 sort c_rank_gdp list country c_rank_gdp gmc_log_cmeangdp sd_cmean_log_gdp if pickone_country==1, noobs * Table of country-level PS7 egen c_rank_ps7 = rank(gmc_log_cmeanps7) if pickone_country==1 sort c_rank_ps7 list country c_rank_ps7 gmc_log_cmeanps7 sd_cmean_log_ps7 if pickone_country==1, noobs * Table of country-level CD egen c_rank_cd = rank(gmc_log_cmeancd) if pickone_country==1 sort c_rank_cd list country c_rank_cd gmc_log_cmeancd sd_cmean_log_cd if pickone_country==1, noobs * Table of country-level NDC egen c_rank_ndc = rank(gmc_log_cmeanndc) if pickone_country==1 sort c_rank_ndc list country c_rank_ndc gmc_log_cmeanndc sd_cmean_log_ndc if pickone_country==1, noobs *** Level-3 (Region-level) means egen rmean_log_gdp = mean(cmean_log_gdp), by(region22) egen rmean_log_ps7 = mean(cmean_log_ps7), by(region22) egen rmean_log_cd = mean(cmean_log_cd), by(region22) egen rmean_log_ndc = mean(cmean_log_ndc), by(region22) egen mean_rmean_log_gdp = mean(rmean_log_gdp) egen mean_rmean_log_ps7 = mean(rmean_log_ps7) egen mean_rmean_log_cd = mean(rmean_log_cd) egen mean_rmean_log_ndc = mean(rmean_log_ndc) gen gmc_log_rmeangdp = rmean_log_gdp - mean_rmean_log_gdp gen gmc_log_rmeanps7 = rmean_log_ps7 - mean_rmean_log_ps7 gen gmc_log_rmeancd = rmean_log_cd - mean_rmean_log_cd gen gmc_log_rmeanndc = rmean_log_ndc - mean_rmean_log_ndc summarize gmc_log_rmeangdp gmc_log_rmeanps7 gmc_log_rmeancd gmc_log_rmeanndc * Level-3 summary * Table of Region-level GDP egen r_rank_gdp = rank(gmc_log_rmeangdp) if pickone_region22==1 sort r_rank_gdp list region22 r_rank_gdp gmc_log_rmeangdp if pickone_region22==1, noobs * Table of Region-level PS7 egen r_rank_ps7 = rank(gmc_log_rmeanps7) if pickone_region22==1 sort r_rank_ps7 list region22 r_rank_ps7 gmc_log_rmeanps7 if pickone_region22==1, noobs * Table of Region-level CD egen r_rank_cd = rank(gmc_log_rmeancd) if pickone_region22==1 sort r_rank_cd list region22 r_rank_cd gmc_log_rmeancd if pickone_region22==1, noobs * Table of Region-level NDC egen r_rank_ndc = rank(gmc_log_rmeanndc) if pickone_region22==1 sort r_rank_ndc list region22 r_rank_ndc gmc_log_rmeanndc if pickone_region22==1, noobs ***************************** ******** Descriptive ******** ***************************** ** tag each observation ** count observations by summing # of tags egen tag = tag(year country) egen count = total(tag), by(country) * Descriptive by country () *** Country-specific means & SD (not logged) egen cmean_dem_100 = mean(dem_100), by(country) egen cmean_gdp = mean(gdp_1000), by(country) egen cmean_ps7 = mean(ps7), by(country) egen cmean_cd = mean(cd), by(country) egen cmean_ndc = mean(ndc), by(country) egen sd_dem_100 = sd(dem_100), by(country) egen sd_gdp = sd(gdp_1000), by(country) egen sd_ps7 = sd(ps7), by(country) egen sd_cd = sd(cd), by(country) egen sd_ndc = sd(ndc), by(country) egen ymean_dem_100 = mean(dem_100), by(year) egen ymean_gdp = mean(gdp_1000), by(year) egen ymean_ps7 = mean(ps7), by(year) egen ymean_cd = mean(cd), by(year) egen ymean_ndc = mean(ndc), by(year) egen ysd_dem_100 = sd(dem_100), by(year) egen ysd_gdp = sd(gdp_1000), by(year) egen ysd_ps7 = sd(ps7), by(year) egen ysd_cd = sd(cd), by(year) egen ysd_ndc = sd(ndc), by(year) egen ydem_100_N = count(dem_100), by (year) egen ygdp_N = count(gdp_1000), by (year) egen yps7_N = count(ps7), by (year) egen ycd_N = count(cd), by (year) egen yndc_N = count(ndc), by (year) * # of countries by year summarize dem_100_N_y gdp_N_y ps7_N_y cd_N_y ndc_N_y ** Year descriptive (supplementary materials, Table 11) sort year list year ymean_dem_100 ysd_dem_100 ydem_100_N ymean_gdp ysd_gdp ygdp_N ymean_ps7 ysd_ps7 yps7_N ymean_cd ysd_cd ycd_N ymean_ndc ysd_ndc yndc_N if pickone_year==1, noobs ** Country descriptive (supplementary materials, Table 12) sort country list country region22 cmean_dem_100 sd_dem_100 dem_100_N cmean_gdp sd_gdp gdp_N cmean_ps7 sd_ps7 ps7_N cmean_cd sd_cd cd_N cmean_ndc sd_ndc ndc_N if pickone_country==1, noobs ** Descriptive stats (The main text, Table 1) summarize dem_100 gdp_1000 ps7 cd ndc ** Level-2 correlation (The main text, Table 2) ** (with # of observed Democracy, Historical Pathogen Prevalence, and Latitude added)** pwcorr cmean_dem_100 cmean_gdp cmean_ps7 cmean_cd cmean_ndc dem_100_N hpp7 lat if pickone_country==1, sig obs *************************************** ************ Analysis 1 *************** *************************************** *************************************************** ******** Variance Components Model - Democracy **** *************************************************** * 1 level xtmixed dem_100, mle var estimates store dem1 * 2 level xtmixed dem_100 || country: , mle var estimates store dem2 lrtest dem1 dem2 * 3 level xtmixed dem_100 || region22: || country: , mle var estimates store dem3 lrtest dem2 dem3 estimates stats dem1 dem2 dem3 * 3 level (log) (This is Model 1 in Table 3 of the main text) xtmixed log_dem_100 || region22: || country: , mle var estimates store model_1 *************************************************** ******** Variance Components Model - GDP ****** *************************************************** xtmixed gdp_1000, mle var estimates store gdp1 xtmixed gdp_1000 || country: , mle var estimates store gdp2 lrtest gdp1 gdp2 xtmixed gdp_1000 || region22: || country: , mle var estimates store gdp3 lrtest gdp2 gdp3 estimates stats gdp1 gdp2 gdp3 *************************************************** ******** Variance Components Model - Pathogens***** *************************************************** xtmixed ps7, mle var estimates store ps1 xtmixed ps7 || country: , mle var estimates store ps2 lrtest ps1 ps2 xtmixed ps7 || region22: || country: , mle var estimates store ps3 lrtest ps2 ps3 estimates stats ps1 ps2 ps3 *************************************************** ******** Variance Components Model - Climate ****** *************************************************** xtmixed cd, mle var estimates store cd1 xtmixed cd || country: , mle var estimates store cd2 lrtest cd1 cd2 xtmixed cd || region22: || country: , mle var estimates store cd3 lrtest cd2 cd3 estimates stats cd1 cd2 cd3 *************************************************** ******** Variance Components Model - Disasters***** *************************************************** xtmixed ndc, mle var estimates store ndc1 xtmixed ndc || country: , mle var estimates store ndc2 lrtest ndc1 ndc2 xtmixed ndc || region22: || country: , mle var estimates store ndc3 lrtest ndc2 ndc3 estimates stats ndc1 ndc2 ndc3 ************************************************************* ******** Analysis 2 - Varying Trajectories of Democracy ***** ************************************************************* * Linear trend (Model 2) xtmixed log_dem_100 year1994 || region22: || country:, mle var estimates store model_2 lrtest dem3_log model_2 * Linear trend + a random slope (Model 3) xtmixed log_dem_100 year1994 || region22: || country: year1994, mle var cov(un) estimates store model_3 * Store fitted values of democracy for Figure 1 & 2 in supplementary materials predict u1_model_3_year u0_model_3, reffects level(country) predict fit_model_3, fitted estimate stats model_1 model_2 model_3 lrtest model_2 model_3 ******************************************** **** Analysis 2 - Quadratic Models ***** ******************************************** * Quadratic trend --> use centered Year xtmixed log_dem_100 year_cent year_quad_cent || region22: || country:, mle var estimates store dem_quad * Quadratic trend + random slopes xtmixed log_dem_100 year_cent year_quad_cent || region22: || country: year_cent year_quad_cent, mle var cov(un) estimates store dem_quad_random ************************************************************** ***** Analysis 3 - Within-Between Mixed-Effects Modeling ***** ************************************************************** ************************************** *** Adding Within-Country Effects **** ************************************** *** Model 4 *** xtmixed log_dem_100 year1994 log_withincgdp log_withincps7 log_withinccd || region22: || country: year1994, mle var cov(un) estimates store model_4_a *** Mode 4 w disasters xtmixed log_dem_100 year1994 log_withincgdp log_withincps7 log_withinccd log_withincndc || region22: || country: year1994, mle var cov(un) estimates store model_4_b ************************************** *** Adding Between-Country Effects *** ************************************** *** Model 5 *** xtmixed log_dem_100 year1994 log_withincgdp log_withincps7 log_withinccd gmc_log_cmeangdp gmc_log_cmeanps7 gmc_log_cmeancd || region22: || country: year1994, mle var cov(un) estimates store model_5 ***************************** *** Adding Random Effects *** ***************************** *** Model 6 *** xtmixed log_dem_100 year1994 log_withincgdp log_withincps7 log_withinccd gmc_log_cmeangdp gmc_log_cmeanps7 gmc_log_cmeancd || region22: || country: year1994 log_withincgdp log_withincps7 log_withinccd, mle var cov(un) estimates store model_6 * Store fitted values of democracy for R visualization (Figure 2 in the main text) predict u1_model_6 u2_model_6 u3_model_6 u4_model_6 u0_model_6, reffects level(country) predict u1_se_model_6 u2_se_model_6 u3_se_model_6 u4_se_model_6 u0_se_model_6, reses level(country) predict fit_model_6, fitted * Include disaster casualties xtmixed log_dem_100 year1994 log_withincgdp log_withincps7 log_withinccd log_withincndc gmc_log_cmeangdp gmc_log_cmeanps7 gmc_log_cmeancd gmc_log_cmeanndc || region22: || country: year1994 log_withincgdp log_withincps7 log_withinccd log_withincndc, mle var estimates store model_6_disaster ** Nonetheless, save fitted values to make Figure 2 in R lrtest no_disaster_random disaster_random predict fit_disaster, fitted predict u1_disaster u2_disaster u3_disaster u4_disaster u5_disaster u0_disaster, reffects level(country) predict u1_disaster_se u2_disaster_se u3_disaster_se u4_disaster_se u5_disaster_se u0_disaster_se, reses level(country) ** Fit different models with random slopes of each variable so that we can compare unique contributions of each xtmixed log_dem_100 year1994 log_withincgdp log_withincps7 log_withinccd gmc_log_cmeangdp gmc_log_cmeanps7 gmc_log_cmeancd || region22: || country: year1994 log_withincgdp, mle var cov(un) estimates store model_6_gdp xtmixed log_dem_100 year1994 log_withincgdp log_withincps7 log_withinccd gmc_log_cmeangdp gmc_log_cmeanps7 gmc_log_cmeancd || region22: || country: year1994 log_withincps7, mle var cov(un) estimates store model_6_ps7 xtmixed log_dem_100 year1994 log_withincgdp log_withincps7 log_withinccd gmc_log_cmeangdp gmc_log_cmeanps7 gmc_log_cmeancd || region22: || country: year1994 log_withinccd, mle var cov(un) estimates store model_6_cd xtmixed log_dem_100 year1994 log_withincgdp log_withincps7 log_withinccd gmc_log_cmeangdp gmc_log_cmeanps7 gmc_log_cmeancd || region22: || country: year1994 log_withincgdp log_withincps7, mle var cov(un) estimates store model_6_gdp_ps7 estimates stats model_5 model_6_gdp model_6_ps7 model_6_cd lrtest model_5 model_6_cd lrtest model_6_gdp_ps7 model_6 ******************************************* **** Adding Cross-level Interactions ****** ******************************************* *** Model 7 *** * Create intraction terms gen GDPxGDP = log_withincgdp*gmc_log_cmeangdp gen PS7xGDP = log_withincps7*gmc_log_cmeangdp gen CDxGDP = log_withinccd*gmc_log_cmeangdp xtmixed log_dem_100 year1994 log_withincgdp log_withincps7 log_withinccd gmc_log_cmeangdp gmc_log_cmeanps7 gmc_log_cmeancd GDPxGDP PS7xGDP CDxGDP || region22: || country: year1994 log_withincgdp log_withincps7 log_withinccd, mle var cov(un) estimates store model_7 * Store fitted values of democracy for visualization (Figure 3 in the main text) predict fit_model_7, fitted predict res_model_7, residuals *** Probing Simple Slopes of GDP x GDP interaction *** * Linear combinations of parameters summarize gmc_log_cmeangdp // 1SD = 1.010452 , 2D = 2.020904 * Intercept and slope at q1 SD above the mean of GDP lincom _cons + gmc_log_cmeangdp*(-2.020904) lincom log_withincgdp + GDPxGDP*(-2.020904) * Intercept and slope at -1 SD above the mean of GDP lincom _cons + gmc_log_cmeangdp*(-1.010452) lincom log_withincgdp + GDPxGDP*(-1.010452) * Intercept and slope at the mean of GDP lincom _cons + gmc_log_cmeangdp*0 // the grand-mean of GDP is 0 lincom log_withincgdp + GDPxGDP*0 * Intercept and slope at +1 SD above the mean of GDP lincom _cons + gmc_log_cmeangdp*(1.010452) lincom log_withincgdp + GDPxGDP*(1.010452) * Intercept and slope at +2 SD above the mean of GDP lincom _cons + gmc_log_cmeangdp*(2.020904) lincom log_withincgdp + GDPxGDP*(2.020904) * Find countries at -/+ 1SD level-2 GDP sort gmc_log_cmeangdp list country gmc_log_cmeangdp if pickone_country==1, noobs * The most parsimonious model (Model 3 of Table 4 in the main text) xtmixed log_dem_100 year1994 log_withincgdp log_withincps7 log_withinccd gmc_log_cmeangdp gmc_log_cmeanps7 GDPxGDP || region22: || country: year1994 log_withincgdp log_withincps7 log_withinccd, mle var cov(un) estimates store model_8 **************************************************** *** Model Comparisons (Table 4 in the main text) *** **************************************************** estimate stats model_1 model_2 model_3 model_4_a model_4_b model_5 model_6 model_7 model_8 * 1 vs. 2 lrtest model_1 model_2 * 2 vs. 3 lrtest model_2 model_3 * 4a vs. 5 lrtest model_4_a model_5 * 5 vs. 6 lrtest model_5 model_6 * 6 vs. 7 lrtest model_6 model_7 // not significant because two interactions are not significant * 6 vs 8 lrtest model_6 model_8 ************************************************ ***** Analysis 4 - Distributed Lag Models ***** ************************************************ tsset countrynum year, yearly sort countrynum year ****** Lag/lead of raw variables ******** foreach varname in log_gdp log_ps7 log_cd log_ndc { gen lag10_`varname' = L10.`varname' gen lag9_`varname' = L9.`varname' gen lag8_`varname' = L8.`varname' gen lag7_`varname' = L7.`varname' gen lag6_`varname' = L6.`varname' gen lag5_`varname' = L5.`varname' gen lag4_`varname' = L4.`varname' gen lag3_`varname' = L3.`varname' gen lag2_`varname' = L2.`varname' gen lag1_`varname' = L1.`varname' gen lag0_`varname' = `varname' gen lead1_`varname' = F1.`varname' gen lead2_`varname' = F2.`varname' gen lead3_`varname' = F3.`varname' gen lead4_`varname' = F4.`varname' gen lead5_`varname' = F5.`varname' gen lead6_`varname' = F6.`varname' gen lead7_`varname' = F7.`varname' gen lead8_`varname' = F8.`varname' gen lead9_`varname' = F9.`varname' gen lead10_`varname' = F10.`varname' } * * Generate first-order differencing foreach varname in lag10_log_gdp lag9_log_gdp lag8_log_gdp lag7_log_gdp lag6_log_gdp lag5_log_gdp lag4_log_gdp lag3_log_gdp lag2_log_gdp lag1_log_gdp lag0_log_gdp lead1_log_gdp lead2_log_gdp lead3_log_gdp lead4_log_gdp lead5_log_gdp lead6_log_gdp lead7_log_gdp lead8_log_gdp lead9_log_gdp lead10_log_gdp lag10_log_ps7 lag9_log_ps7 lag8_log_ps7 lag7_log_ps7 lag6_log_ps7 lag5_log_ps7 lag4_log_ps7 lag3_log_ps7 lag2_log_ps7 lag1_log_ps7 lag0_log_ps7 lead1_log_ps7 lead2_log_ps7 lead3_log_ps7 lead4_log_ps7 lead5_log_ps7 lead6_log_ps7 lead7_log_ps7 lead8_log_ps7 lead9_log_ps7 lead10_log_ps7 lag10_log_cd lag9_log_cd lag8_log_cd lag7_log_cd lag6_log_cd lag5_log_cd lag4_log_cd lag3_log_cd lag2_log_cd lag1_log_cd lag0_log_cd lead1_log_cd lead2_log_cd lead3_log_cd lead4_log_cd lead5_log_cd lead6_log_cd lead7_log_cd lead8_log_cd lead9_log_cd lead10_log_cd { gen d1_`varname' = D1.`varname' } * **** Grand-mean centering the baseline covariates **** * Mean of GDP foreach varname in lag10_log_gdp lag9_log_gdp lag8_log_gdp lag7_log_gdp lag6_log_gdp lag5_log_gdp lag4_log_gdp lag3_log_gdp lag2_log_gdp lag1_log_gdp { egen mean_`varname' = mean(`varname') } * * Mean of PS7 foreach varname in lag10_log_ps7 lag9_log_ps7 lag8_log_ps7 lag7_log_ps7 lag6_log_ps7 lag5_log_ps7 lag4_log_ps7 lag3_log_ps7 lag2_log_ps7 lag1_log_ps7 { egen mean_`varname' = mean(`varname') } * * Mean of CD foreach varname in lag10_log_cd lag9_log_cd lag8_log_cd lag7_log_cd lag6_log_cd lag5_log_cd lag4_log_cd lag3_log_cd lag2_log_cd lag1_log_cd { egen mean_`varname' = mean(`varname') } * * Grand-mean centering baseline covariates gen gmc_lag10_log_gdp = lag10_log_gdp - mean_lag10_log_gdp gen gmc_lag9_log_gdp = lag9_log_gdp - mean_lag9_log_gdp gen gmc_lag8_log_gdp = lag8_log_gdp - mean_lag8_log_gdp gen gmc_lag7_log_gdp = lag7_log_gdp - mean_lag7_log_gdp gen gmc_lag6_log_gdp = lag6_log_gdp - mean_lag6_log_gdp gen gmc_lag5_log_gdp = lag5_log_gdp - mean_lag5_log_gdp gen gmc_lag4_log_gdp = lag4_log_gdp - mean_lag4_log_gdp gen gmc_lag3_log_gdp = lag3_log_gdp - mean_lag3_log_gdp gen gmc_lag2_log_gdp = lag2_log_gdp - mean_lag2_log_gdp gen gmc_lag1_log_gdp = lag1_log_gdp - mean_lag10_log_gdp gen gmc_lag10_log_ps7 = lag10_log_ps7 - mean_lag10_log_ps7 gen gmc_lag9_log_ps7 = lag9_log_ps7 - mean_lag9_log_ps7 gen gmc_lag8_log_ps7 = lag8_log_ps7 - mean_lag8_log_ps7 gen gmc_lag7_log_ps7 = lag7_log_ps7 - mean_lag7_log_ps7 gen gmc_lag6_log_ps7 = lag6_log_ps7 - mean_lag6_log_ps7 gen gmc_lag5_log_ps7 = lag5_log_ps7 - mean_lag5_log_ps7 gen gmc_lag4_log_ps7 = lag4_log_ps7 - mean_lag4_log_ps7 gen gmc_lag3_log_ps7 = lag3_log_ps7 - mean_lag3_log_ps7 gen gmc_lag2_log_ps7 = lag2_log_ps7 - mean_lag2_log_ps7 gen gmc_lag1_log_ps7 = lag1_log_ps7 - mean_lag10_log_ps7 gen gmc_lag10_log_cd = lag10_log_cd - mean_lag10_log_cd gen gmc_lag9_log_cd = lag9_log_cd - mean_lag9_log_cd gen gmc_lag8_log_cd = lag8_log_cd - mean_lag8_log_cd gen gmc_lag7_log_cd = lag7_log_cd - mean_lag7_log_cd gen gmc_lag6_log_cd = lag6_log_cd - mean_lag6_log_cd gen gmc_lag5_log_cd = lag5_log_cd - mean_lag5_log_cd gen gmc_lag4_log_cd = lag4_log_cd - mean_lag4_log_cd gen gmc_lag3_log_cd = lag3_log_cd - mean_lag3_log_cd gen gmc_lag2_log_cd = lag2_log_cd - mean_lag2_log_cd gen gmc_lag1_log_cd = lag1_log_cd - mean_lag10_log_cd ************************ ***** 2 years lag ***** ************************ xtmixed log_dem_100 year1994 gmc_lag2_log_gdp d1_lag1_log_gdp d1_lag0_log_gdp d1_lead1_log_gdp d1_lead2_log_gdp gmc_lag2_log_ps7 d1_lag1_log_ps7 d1_lag0_log_ps7 d1_lead1_log_ps7 d1_lead2_log_ps7 || region22: || country: year1994, mle var cov(un) estimates store lag_2 estimates stats lag_2 ************************ ***** 3 years lag ***** ************************ xtmixed log_dem_100 year1994 gmc_lag3_log_gdp d1_lag2_log_gdp d1_lag1_log_gdp d1_lag0_log_gdp d1_lead1_log_gdp d1_lead2_log_gdp d1_lead3_log_gdp gmc_lag3_log_ps7 d1_lag2_log_ps7 d1_lag1_log_ps7 d1_lag0_log_ps7 d1_lead1_log_ps7 d1_lead2_log_ps7 d1_lead3_log_ps7 || region22: || country: year1994, mle var cov(un) estimates store lag_3 estimates stats lag_3 ************************ ***** 4 years lag ***** ************************ xtmixed log_dem_100 year1994 gmc_lag4_log_gdp d1_lag3_log_gdp d1_lag2_log_gdp d1_lag1_log_gdp d1_lag0_log_gdp d1_lead1_log_gdp d1_lead2_log_gdp d1_lead3_log_gdp d1_lead4_log_gdp gmc_lag4_log_ps7 d1_lag3_log_ps7 d1_lag2_log_ps7 d1_lag1_log_ps7 d1_lag0_log_ps7 d1_lead1_log_ps7 d1_lead2_log_ps7 d1_lead3_log_ps7 d1_lead4_log_ps7 || region22: || country: year1994, mle var cov(un) estimates store lag_4 estimates stats lag_4 ******************************************************************* ***** Analyses that go into Supplementary Materials *************** ******************************************************************* * Fixed effect approach (without disasters) xtmixed log_dem_100 year1994 log_gdp log_ps7 log_cd || region22: || country: year1994, mle var cov(un) predict fix_year fix_intercept, reffects level(country) * See correlations of fixed approach pwcorr log_gdp log_ps7 log_cd fix_intercept fix_year gmc_log_cmeangdp gmc_log_cmeanps7 gmc_log_cmeancd, sig obs * See correlations of random approach pwcorr log_withincgdp log_withincps7 log_withinccd random_intercept random_year gmc_log_cmeangdp gmc_log_cmeanps7 gmc_log_cmeancd, sig obs * Random-effects model with Disasters xtmixed log_dem_100 year1994 log_withincgdp log_withincps7 log_withinccd log_withincndc gmc_log_cmeangdp gmc_log_cmeanps7 gmc_log_cmeancd gmc_log_cmeanndc || region22: || country: year1994, mle var cov(un) * Unstructured model did not converge xtmixed log_dem_100 year1994 log_withincgdp log_withincps7 log_withinccd log_withincndc gmc_log_cmeangdp gmc_log_cmeanps7 gmc_log_cmeancd gmc_log_cmeanndc || region22: || country: year1994 log_withincgdp log_withincps7 log_withinccd, mle var estimates store no_disaster_random ** Climate as a moderator xtmixed log_dem_100 year1994 c.log_withincgdp##c.gmc_log_cmeancd c.log_withincps7##c.gmc_log_cmeancd c.log_withinccd##c.gmc_log_cmeancd gmc_log_cmeangdp gmc_log_cmeanps7 || region22: || country: year1994 log_withincgdp log_withincps7 log_withinccd, mle var cov(un) ** Pathogens as a moderator xtmixed log_dem_100 year1994 c.log_withincgdp##c.gmc_log_cmeanps7 c.log_withincps7##c.gmc_log_cmeanps7 c.log_withinccd##c.gmc_log_cmeanps7 gmc_log_cmeangdp gmc_log_cmeancd || region22: || country: year1994 log_withincgdp log_withincps7 log_withinccd, mle var cov(un) **************************************** *** Checking Outliers & Interactions *** **************************************** *** Region-level Slope (Model 8 in supplementary materials) xtmixed log_dem_100 year1994 c.log_withincgdp##c.gmc_log_cmeangdp c.log_withincps7##c.gmc_log_cmeangdp c.log_withinccd##c.gmc_log_cmeangdp gmc_log_cmeanps7 gmc_log_cmeancd || region22: log_withincgdp log_withincps7 log_withinccd || country: year1994 log_withincgdp log_withincps7 log_withinccd, mle var cov(un) estimates store log__log_region_slope estimate stats dem3_log dem_year1994 dem_year1994_random dem_1og_log within_between dem_1og_log_random_un dem_1og_log_random_cross log__log_region_slope lrtest dem_1og_log_random_cross log__log_region_slope predict fit_random_region, fitted predict u_year u_gdp u_ps7 u_cd u_intercept, reffects level(country) predict u_year_se u_gdp_se u_ps7_se u_cd_se u_intercept_se, reses level(country) predict v_gdp v_ps7 v_cd v_intercept, reffects level(region22) predict v_gdp_se v_ps7_se v_cd_se v_intercept_se, reses level(region22) *** Country-level slopes *** * Rank random-slope of GDP (country) egen u_gdp_rank = rank(u_gdp) if pickone_country==1 sort u_gdp_rank list country u_gdp_rank u_gdp u_gdp_se if pickone_country==1, noobs summarize u_gdp generate labheight_u_gdp = u_gdp + 1.96*u_gdp_se + 0 serrbar u_gdp u_gdp_se u_gdp_rank if pickone_country==1, scale(1.96) yline(0) addplot(scatter labheight_u_gdp u_gdp_rank, mlabel(country) mlabposition(6) msymbol(none) mlabsize(tiny) mlabgap(2) mlabangle(-90) mlabcolor(navy) ) ytitle("Country-level random-slope of GDP") xtitle("Rank") xsc(r(0 165)) legend(off) * Rank random-slope of Pathogens (country) egen u_ps7_rank = rank(u_ps7) if pickone_country==1 sort u_ps7_rank list country u_ps7_rank u_ps7 u_ps7_se if pickone_country==1, noobs summarize u_ps7 generate labheight_u_ps7 = u_ps7 + 1.96*u_ps7_se + 0 serrbar u_ps7 u_ps7_se u_ps7_rank if pickone_country==1, scale(1.96) yline(0) addplot(scatter labheight_u_ps7 u_ps7_rank, mlabel(country) mlabposition(6) msymbol(none) mlabsize(tiny) mlabgap(2) mlabangle(-90) mlabcolor(navy) ) ytitle("Country-level random-slope of Pathogens") xtitle("Rank") xsc(r(0 165)) legend(off) * Rank random-slope of CD (country) egen u_cd_rank = rank(u_cd) if pickone_country==1 sort u_cd_rank list country u_cd_rank u_cd u_cd_se if pickone_country==1, noobs summarize u_cd generate labheight_u_cd = u_cd + 1.96*u_cd_se + 0 serrbar u_cd u_cd_se u_cd_rank if pickone_country==1, scale(1.96) yline(0) addplot(scatter labheight_u_cd u_cd_rank, mlabel(country) mlabposition(6) msymbol(none) mlabsize(tiny) mlabgap(2) mlabangle(-90) mlabcolor(navy) ) ytitle("Country-level random-slope of Climate") xtitle("Rank") xsc(r(0 165)) legend(off) *** Region-level slopes *** * Rank random-slope of GDP (Region) egen v_gdp_rank = rank(v_gdp) if pickone_region22==1 sort v_gdp_rank list region22 v_gdp_rank v_gdp v_gdp_se if pickone_region22==1, noobs summarize v_gdp generate labheight_v_gdp = v_gdp + 1.96*v_gdp_se + 0 serrbar v_gdp v_gdp_se v_gdp_rank if pickone_region22==1, scale(1.96) yline(0) addplot(scatter labheight_v_gdp v_gdp_rank, mlabel(region22) mlabposition(6) msymbol(none) mlabsize(tiny) mlabgap(2) mlabangle(-90) mlabcolor(navy)) ytitle("Region-level random-slope of GDP") xtitle("Rank") xsc(r(0 20)) legend(off) * Rank random-slope of PS7 (Region) egen v_ps7_rank = rank(v_ps7) if pickone_region22==1 sort v_ps7_rank list region22 v_ps7_rank v_ps7 v_ps7_se if pickone_region22==1, noobs summarize v_ps7 generate labheight_v_ps7 = v_ps7 + 1.96*v_ps7_se + 0 serrbar v_ps7 v_ps7_se v_ps7_rank if pickone_region22==1, scale(1.96) yline(0) addplot(scatter labheight_v_ps7 v_ps7_rank, mlabel(region22) mlabposition(6) msymbol(none) mlabsize(tiny) mlabgap(2) mlabangle(-90) mlabcolor(navy)) ytitle("Region-level random-slope of Pathogens") xtitle("Rank") xsc(r(0 20)) legend(off) * Rank random-slope of CD (Region) egen v_cd_rank = rank(v_cd) if pickone_region22==1 sort v_cd_rank list region22 v_cd_rank v_cd v_cd_se if pickone_region22==1, noobs summarize v_cd generate labheight_v_cd = v_ps7 + 1.96*v_cd_se + 0 serrbar v_cd v_cd_se v_cd_rank if pickone_region22==1, scale(1.96) yline(0) addplot(scatter labheight_v_cd v_cd_rank, mlabel(region22) mlabposition(6) msymbol(none) mlabsize(tiny) mlabgap(2) mlabangle(-90) mlabcolor(navy)) ytitle("Region-level random-slope of Climate") xtitle("Rank") xsc(r(0 20)) legend(off) **** South America dummy (everything else as a reference group for Pathogen interactions) **** generate south_america = 0 replace south_america = 1 if region22=="South America" gen PS7xSA = log_withincps7*south_america * Add South America Dummy to Model 7 xtmixed log_dem_100 year1994 c.log_withincgdp##c.gmc_log_cmeangdp c.log_withincps7##c.gmc_log_cmeangdp c.log_withinccd##c.gmc_log_cmeangdp gmc_log_cmeanps7 gmc_log_cmeancd PS7xSA || region22: || country: year1994 log_withincgdp log_withincps7 log_withinccd, mle var cov(un) estimates store dem_1og_log_south_america lincom _cons + 0*PS7xSA lincom log_withincps7 + 0*PS7xSA lincom _cons + 1*PS7xSA lincom log_withincps7 + 1*PS7xSA **** Exclude Tuberculosis (use ps6 instead) xtmixed log_dem_100 year1994 c.log_withincgdp##c.gmc_log_cmeangdp c.log_withincps6##c.gmc_log_cmeangdp c.log_withinccd##c.gmc_log_cmeangdp gmc_log_cmeanps7 gmc_log_cmeancd || region22: || country: year1994 log_withincgdp log_withincps6 log_withinccd, mle var cov(un) ***** Random effects of lags/leads of GDP (pathogen does not converge) * Lag 2 with random-effects of GDP xtmixed log_dem_100 year1994 gmc_lag2_log_gdp d1_lag1_log_gdp d1_lag0_log_gdp d1_lead1_log_gdp d1_lead2_log_gdp gmc_lag2_log_ps7 d1_lag1_log_ps7 d1_lag0_log_ps7 d1_lead1_log_ps7 d1_lead2_log_ps7 || region22: || country: year1994 gmc_lag2_log_gdp d1_lag1_log_gdp d1_lag0_log_gdp d1_lead1_log_gdp d1_lead2_log_gdp, mle var estimates store lag2_random * Lag 3 with random-effects of GDP (unstable) xtmixed log_dem_100 year1994 gmc_lag3_log_gdp d1_lag2_log_gdp d1_lag1_log_gdp d1_lag0_log_gdp d1_lead1_log_gdp d1_lead2_log_gdp d1_lead3_log_gdp gmc_lag3_log_ps7 d1_lag2_log_ps7 d1_lag1_log_ps7 d1_lag0_log_ps7 d1_lead1_log_ps7 d1_lead2_log_ps7 d1_lead3_log_ps7 || region22: || country: year1994 gmc_lag3_log_gdp d1_lag2_log_gdp d1_lag1_log_gdp d1_lag0_log_gdp d1_lead1_log_gdp d1_lead2_log_gdp d1_lead3_log_gdp , mle var estimates store lag3_random * Lag 4 with random-effects (did not produce random effects) xtmixed log_dem_100 year1994 gmc_lag4_log_gdp d1_lag3_log_gdp d1_lag2_log_gdp d1_lag1_log_gdp d1_lag0_log_gdp d1_lead1_log_gdp d1_lead2_log_gdp d1_lead3_log_gdp d1_lead4_log_gdp gmc_lag4_log_ps7 d1_lag3_log_ps7 d1_lag2_log_ps7 d1_lag1_log_ps7 d1_lag0_log_ps7 d1_lead1_log_ps7 d1_lead2_log_ps7 d1_lead3_log_ps7 d1_lead4_log_ps7 || region22: || country: year1994 gmc_lag4_log_gdp d1_lag3_log_gdp d1_lag2_log_gdp d1_lag1_log_gdp d1_lag0_log_gdp d1_lead1_log_gdp d1_lead2_log_gdp d1_lead3_log_gdp d1_lead4_log_gdp, mle var estimates store lag4_random