eAppendix Table 1. Missing data imputation

Imputation of missing data was performed with chained equations in STATA using the mi impute chained command with 10 burn-in cycles. Multiple linear regression was used to impute BMI values which were inverse transformed and the distributions of imputed and observed values were compared graphically. Logistic regression was used to impute dichotomous variables and multinomial logistic regression was used to impute categorical variables. All analytic variables were included as regressors in imputation models.

Variable / Percent Missing / Imputation Method
NDI / 10.2% / Multinomial logistic regression
Healthy food vendor density / 9.4% / Multinomial logistic regression
Unhealthy food vendor density / 9.4% / Multinomial logistic regression
BMI (inverse-transformed) / 4.2% / Linear multiple regression
Diet / 17.3% / Logistic regression
Physical activity / 15.7% / Logistic regression
Smoking / 15.7% / Logistic regression
Race / 3.9% / Multinomial logistic regression
Income to poverty ratio / 15.5% / Multinomial logistic regression
Education / 1.5% / Multinomial logistic regression
Household size / 4.9% / Multinomial logistic regression
Marital status / 4.3% / Multinomial logistic regression
Assets / 22.0% / Logistic regression
Unemployment / 3.2% / Logistic regression
Nativity / 3.6% / Logistic regression
Internal locus of control / 18.3% / Logistic regression
External locus of control / 18.6% / Logistic regression
Population density / 7.0% / Multinomial logistic regression

1

eAppendix Table 2. Prediction models

Variable / Model Type / Model Specification
Healthful vendor density
( / Multinomial logistic /
Unhealthful vendor density
/ Multinomial logistic /
Physically active
/ Logistic /
Smoker
/ Logistic /
Diet adherence
/ Logistic /
BMI
/ Linear (inverse transformed) /
Obesity
/ Logistic /
Severe obesity
/ Logistic /

: NDI,: age, : gender,: race,: education, : income, : value of assets, : marital status, : nativity, : employment status, household size, : internal locus of control, : external locus of control, : population density

eAppendix Table 3. Subcomponent mediation parameter definitions

Parameter / Definition
a /
b /
c /
d /
e /
f /
g /
h /
i /
J /

1

eAppendix Table 4. Comparison of observed versus simulated outcome values under the natural course (no-intervention scenario)

Neighborhood Deprivation (NDI) / Healthful food vendor density / Unhealthful food vendor density
Qt 1 / Qt 2 / Qt 3 / Qt 4 / Qt 1 / Qt 2 / Qt 3 / Qt 4 / Qt 1 / Qt 2 / Qt 3 / Qt 4
Mean inverse BMI
Natural course / 0.034 / 0.033 / 0.033 / 0.032 / 0.033 / 0.033 / 0.033 / 0.033 / 0.033 / 0.033 / 0.033 / 0.033
Observed / 0.034 / 0.033 / 0.033 / 0.032 / 0.033 / 0.033 / 0.033 / 0.033 / 0.033 / 0.033 / 0.033 / 0.033
Obesity prevalence
Natural course / 45.5% / 49.2% / 51.7% / 58.1% / 52.3% / 52.6% / 51.2% / 48.3% / 50.8% / 49.8% / 51.8% / 52.0%
Observed / 45.5% / 49.1% / 51.6% / 57.9% / 53.7% / 52.9% / 50.8% / 46.7% / 50.8% / 49.8% / 51.6% / 51.9%
Severe obesity prevalence
Natural course / 22.5% / 25.5% / 28.4% / 32.7% / 27.9% / 28.5% / 27.3% / 25.5% / 26.7% / 26.4% / 28.0% / 28.2%
Observed / 22.8% / 25.7% / 28.6% / 32.3% / 28.5% / 29.1% / 27.6% / 24.7% / 27.0% / 26.3% / 28.1% / 28.6%

Data Access

Survey data for the Diabetes Study of Northern California (DISTANCE) and clinical records are confidential and maintained by the Kaiser Permanente Division of Research. For more information or to collaborate please contact Howard H. Moffett (MPH),

eAppendix STATA G-computation mediation analysis

#delimit;

clear;

set mem 900m;

set matsize 800;

set more off;

capture log close;

********************************************************************************/

**G-computation mediation analysis

**

** DESCRIPTION: Uses data from the Kaiser Permanente DISTANCE cohort (2005) to

**estimate mediation effects between:

**1. Exposure: neighborhood deprivation (NDI)

**2. Mediators: healthful (HFE) and unhealthful (UFE) food retail density

**3. Intermediate outcome: diet adherence

**4. Outcomes: BMI, obesity and severe obesity

**

**G-computation was used to estimate:

**1. The total causal effect of NDI on each outcome

**2. The controlled direct effect of NDI on each outcome holding

**HFE and UFE constant at the highest quartile (4)

**3. The natural direct effect of NDI on each outcome

**4. The natural indirect effect of NDI on each outcome

**5. Subcomponent effects of the natural direct effect and natural

**indirect effect

**

** CONTENTS

**STEP 1. Setting up program environment

**STEP 1a. Set up the workspace

** STEP 1b. Defining mini-programs for repetititive tasks

** that are called by the larger gcompmediation program

**

**STEP 2. Defining gcompmediation program for direct/indirects with G-comp.

**STEP 2a. Program set up

**STEP 2c. Loading and sampling data

**STEP 2d. Imputation of missing data

**STEP 2e. Recreating analysis vars from imputed data

**STEP 2f: Creating interaction terms

** STEP 2g: Creating placeholder variables

** STEP 2h: Data exclusions

** STEP 2i. G-computation model

**STEP 2i.1: Healthy food retail density predictor model

**STEP 2i.2: Unhealthy food retail density predictor model

**STEP 2i.3: Physical activity predictor model

**STEP 2i.4: Smoking predictor model

**STEP 2i.5: Diet adherence predictor model

**STEP 2i.6: BMI predictor model

**STEP 2i.7: Obese predictor model

**Step 2i.8: Severely obese predictor model

**

** STEP 3. Test run gcompmediation program using trace command

** STEP 4. Bootstrapping gcompmediation program and obtaining 95% confidence

**intervals for all estimates

**

** PROGRAMMER: Yun Tara Zhang ()

**DATE: 10.08.2014

**

**DATA IN: "$data\dep2_sdd_recoded_noshort.dta"

** DATA OUT: "$data\gcompmediation_bootstrap.dta"

********************************************************************************;

****************************************************************************

**** STEP 1. Setting up program environment

***************************************************************************;

*------;

*Step 1a. Set up the workspace

*------;

* Dropping all global scalars;

scalar drop _all;

* Clearing all graphs;

graph drop _all;

* Set up global directories

global data="J:\distance\DEP2\DATA";

global logs="J:\distance\DEP2\LOGS";

*Setting log file;

log using "$logs\2_gcomp_mediation_ndi_bmi_09.09.2014.smcl",

replace;

*------;

*Step 1b. Defining mini-programs for repetititive tasks

* that are called by the larger gcompmediation program

*------;

*------;

*This program updates variable interaction terms after the main

*variables have been changed

*------;

capture program drop updateinteract;

program define updateinteract;

args v1 v2;

local indi indi_qt1 indi_qt2 indi_qt3 indi_qt4;

local ipopden ipopden_qt1 ipopden_qt2 ipopden_qt3 ipopden_qt4;

local iunemploy iunemploy;

local icursmk icursmk;

local igood_act igood_act;

local igood_diet2 igood_diet2;

local imale imale;

local agecat agecat1 agecat2 agecat3;

local irace irace1 irace2 irace3 irace4 irace5;

local ieducat ieducat1 ieducat2 ieducat3 ieducat4 ieducat5;

local iincrat_cat iincrat_cat1 iincrat_cat2 iincrat_cat3

iincrat_cat4;

local ihfe ihfe_qt1 ihfe_qt2 ihfe_qt3 ihfe_qt4;

local iufe iufe_qt1 iufe_qt2 iufe_qt3 iufe_qt4;

foreach x of local `v1' {;

foreach y of local `v2' {;

display "`x'" "`y'";

replace `x'`y'=`x'*`y';

};

};

end;

*------;

*This program sets a variable (NDI, HFE or UFE) to 1, 4 or

*the natural value under NDI==1 or NDI==4;

*------;

capture program drop setval;

program define setval;

args x val;

if "`x'"=="ndi" {;

if "`val'"=="1" {;

replace indi_qt1=1;

replace indi_qt2=0;

replace indi_qt3=0;

replace indi_qt4=0;

};

else if "`val'"=="4" {;

replace indi_qt1=0;

replace indi_qt2=0;

replace indi_qt3=0;

replace indi_qt4=1;

};

else {;

exit 110;

};

};

else if "`x'"=="hfe" {;

if "`val'"=="1" {;

replace ihfe_qt1=1;

replace ihfe_qt2=0;

replace ihfe_qt3=0;

replace ihfe_qt4=0;

};

else if "`val'"=="4" {;

replace ihfe_qt1=0;

replace ihfe_qt2=0;

replace ihfe_qt3=0;

replace ihfe_qt4=1;

};

else if "`val'"=="A1" {;

replace ihfe_qt1=ihfe_qt1_A1;

replace ihfe_qt2=ihfe_qt2_A1;

replace ihfe_qt3=ihfe_qt3_A1;

replace ihfe_qt4=ihfe_qt4_A1;

};

else if "`val'"=="A4" {;

replace ihfe_qt1=ihfe_qt1_A4;

replace ihfe_qt2=ihfe_qt2_A4;

replace ihfe_qt3=ihfe_qt3_A4;

replace ihfe_qt4=ihfe_qt4_A4;

};

else {;

exit 110;

};

};

else if "`x'"=="ufe" {;

if "`val'"=="1" {;

replace iufe_qt1=1;

replace iufe_qt2=0;

replace iufe_qt3=0;

replace iufe_qt4=0;

};

else if "`val'"=="4" {;

replace iufe_qt1=0;

replace iufe_qt2=0;

replace iufe_qt3=0;

replace iufe_qt4=1;

};

else if "`val'"=="A1" {;

replace iufe_qt1=iufe_qt1_A1;

replace iufe_qt2=iufe_qt2_A1;

replace iufe_qt3=iufe_qt3_A1;

replace iufe_qt4=iufe_qt4_A1;

};

else if "`val'"=="A4" {;

replace iufe_qt1=iufe_qt1_A4;

replace iufe_qt2=iufe_qt2_A4;

replace iufe_qt3=iufe_qt3_A4;

replace iufe_qt4=iufe_qt4_A4;

};

else {;

exit 110;

};

};

else if "`x'"=="cursmk" {;

if "`val'"=="A1" {;

replace icursmk=icursmkA1;

};

else if "`val'"=="A4" {;

replace icursmk=icursmkA4;

};

else {;

exit 110;

};

};

else if "`x'"=="good_act" {;

if "`val'"=="A1" {;

replace igood_act=igood_actA1;

};

else if "`val'"=="A4" {;

replace igood_act=igood_actA4;

};

else {;

exit 110;

};

};

else {;

exit 110;

};

end;

*------;

*This program resets exposure, mediators,

*and covariates to original values;

*------;

capture program drop returnorig;

program returnorig;

*Set NDI to original values;

replace indi_qt4=indi_qt4_r;

replace indi_qt3=indi_qt3_r;

replace indi_qt2=indi_qt2_r;

replace indi_qt1=indi_qt1_r;

*Set physical activity to original value;

replace igood_act=igood_act_r;

*Set smoking status to original value;

replace icursmk=icursmk_r;

*Set HFE to original values;

replace ihfe_qt1=ihfe_qt1_r;

replace ihfe_qt2=ihfe_qt2_r;

replace ihfe_qt3=ihfe_qt3_r;

replace ihfe_qt4=ihfe_qt4_r;

*Set UFE to original values;

replace iufe_qt1=iufe_qt1_r;

replace iufe_qt2=iufe_qt2_r;

replace iufe_qt3=iufe_qt3_r;

replace iufe_qt4=iufe_qt4_r;

*Set diet to original values;

replace igood_diet2=igood_diet2_r;

end;

*------;

*This program predicts diet if NDI is set to "A",

*HFE is set to "H", and UFE is set to "U". The

*predicted values of diet are stored as variable "pdiet";

*------;

capture program drop predictdiet;

program define predictdiet;

args A H U pdiet;

if "`A'"=="1" | "`A'"=="4" {;

*Set NDI to value "A";

setval ndi "`A'";

*Set physical activity to natural value if NDI="A";

setval good_act A`A';

*Set smoking status to natural value if NDI="A";

setval cursmk A`A';

};

else {;

exit 110;

};

if "`H'"=="1" | "`H'"=="4" {;

*Set HFE to value "H";

setval hfe "`H'";

};

else if "`H'"=="A1" | "`H'"=="A4" {;

*Set HFE to natural value under "H";

setval hfe "`H'";

};

else {;

exit 110;

};

if "`U'"=="1" | "`U'"=="4" {;

*Set UFE to value "U";

setval ufe "`U'";

};

else if "`U'"=="A1" | "`U'"=="A4" {;

*Set UFE to natural value under "U";

setval ufe "`U'";

};

else {;

exit 110;

};

*Recreating interaction terms;

*NDI x HFE;

updateinteract indi ihfe;

*NDI and race;

updateinteract indi irace;

*NDI and education;

updateinteract indi ieducat;

*Current smoking and education;

updateinteract icursmk ieducat;

*Physical activity and age;

updateinteract igood_act agecat;

*Physical activity and education;

updateinteract igood_act ieducat;

if "`pdiet'"!="" {;

*Predict diet value under variable settings;

predict "`pdiet'" if e(sample), pr;

display "`pdiet'";

sum `pdiet';

};

else {;

exit 110;

};

end;

*------;

*This program predicts bmi, obese, or severe obese

*if NDI is set to "A", HFE is set to "H", UFE is set

*to "U" and diet is set to "D". The predicted values

*of the outcome are stored as variable "pY";

*------;

capture program drop predictY;

program define predictY;

args Y A H U D pY;

*Check that outcome is legitimate;

if "`Y'"=="bmi" | "`Y'"=="obese" | "`Y'"=="obsev" {;

*If outcome is legitimate, then

*check that NDI value is legitimate;

if "`A'"=="1" | "`A'"=="4" {;

*Set NDI to value "A";

setval ndi "`A'";

*Set physical activity to natural value if

*NDI="A";

setval good_act A`A';

*Set smoking status to natural value if NDI="A";

setval cursmk A`A';

};

else {;

exit 110;

};

*Check that HFE value is legitimate;

if "`H'"=="1" |

"`H'"=="4" |

"`H'"=="A1" |

"`H'"=="A4" | {;

*Set HFE to value "H";

setval hfe "`H'";

};

else {;

exit 110;

};

*Check that UFE value is legitimate;

if "`U'"=="1" |

"`U'"=="4" |

"`U'"=="A1" |

"`U'"=="A4" {;

*Set UFE to value "U";

setval ufe "`U'";

};

else {;

exit 110;

};

*Check that diet value is legitimate;

if "`D'"=="dietA1_H1U1" |

"`D'"=="dietA4_H1U1" |

"`D'"=="dietA1_H4U4" |

"`D'"=="dietA4_H4U4" |

"`D'"=="dietA1_Ha1Ua1" |

"`D'"=="dietA4_Ha4Ua4" |

"`D'"=="dietA1_Ha4Ua4" |

"`D'"=="dietA1_Ha4Ua1" |

"`D'"=="dietA1_Ha1Ua4" |

"`D'"=="dietA4_Ha1Ua1" |

"`D'"=="dietA4_Ha1Ua4" |

"`D'"=="dietA4_Ha4Ua1" {;

*Set diet to value "D";

replace igood_diet2= `D';

};

else {;

exit 110;

};

if "`Y'"=="bmi" {;

*Recreating interaction terms;

*Unemploy and current smoking;

updateinteract iunemploy icursmk;

*NDI and good_diet;

updateinteract indi igood_diet2;

*Good_diet and gender;

updateinteract igood_diet2 imale;

*Current smoking and race;

updateinteract icursmk irace;

*Physical activity and education;

updateinteract igood_act ieducat;

*Physical activity and race;

updateinteract igood_act irace;

*Physical activity and current smoking;

updateinteract igood_act icursmk;

*Gender and physical activity;

updateinteract imale igood_act;

*HFE and UFE;

updateinteract ihfe iufe;

*Predict bmi value under variable settings;

predict iinv`pY' if e(sample);

*Transforming predictions back into standard bmi

*units;

gen `pY'=1/iinv`pY';

display "`pY'";

sum `pY', detail;

};

else if "`Y'"=="obese" {;

*Recreating interaction terms;

*UFE and race;

updateinteract iufe irace;

*Good_diet and race;

updateinteract igood_diet2 irace;

*Physical activity and current smoking;

updateinteract igood_act icursmk;

*Unemploy and current smoking;

updateinteract iunemploy icursmk;

*Physical activity and education;

updateinteract igood_act ieducat

*Current smoking and race;

updateinteract icursmk irace;

*Good_diet and smoking;

updateinteract igood_diet2 icursmk;

*Predict obese probability under variable settings;

predict `pY' if e(sample), pr;

sum `pY';

};

else if "`Y'"=="obsev" {;

*Recreating interaction terms;

*NDI and population density;

updateinteract indi ipopden;

*Good_diet and race;

updateinteract igood_diet2 irace;

*NDI and good_diet;

updateinteract indi igood_diet2;

*Unemploy and current smoking;

updateinteract iunemploy icursmk;

*Unemploy and physical activity;

updateinteract iuemploy igood_act;

*Physical activity and age;

updateinteract igood_act agecat;

*Physical activity and education;

updateinteract igood_act ieducat;

*Good_diet and smoking;

updateinteract igood_diet2 icursmk;

*Good_diet and gender;

updateinteract igood_diet2 imale;

*Predict severe obese probability under variable

*settings;

predict `pY' if e(sample), pr;

sum `pY';

};

};

else {; /*if outcome Y is not legitimate, display error*/

exit 110;

};

end;

*******************************************************************************;

****** STEP 2. G-COMP PROGRAM FOR BOOTSTRAPPING **

*******************************************************************************;

* *

* Creates a program named "gcompmediation" which calculates the total *

*causal effect, controlled direct effect, natural direct effect, and *

*natural indirect effects of a reduction in NDI (from 4th to 1st quartile) *

* on three outcomes: BMI, obese, and severely obese through food environment *

* mediators (healthy and unhealthy food retail density) and proximal outcome *

* diet. This analysis uses the g-computation substitution estimator and *

* standard errors are obtained by bootstrapping this entire program *

*STEP 2a. Program set up *

*STEP 2b. Loading and sampling data *

*STEP 2c. Imputation of missing data *

*STEP 2d. Keeping only imputed data *

*STEP 2e. Recreating analysis vars from imputed data *

*STEP 2f: Creating interaction terms *

* STEP 2g: Creating placeholder variables *

* STEP 2h: Data exclusions *

* STEP 2i. G-computation model *

*STEP 2i.1: Healthy food retail density predictor model *

*STEP 2i.2: Unhealthy food retail density predictor model *

*STEP 2i.3: Physical activity predictor model *

*STEP 2i.4: Smoking predictor model *

*STEP 2i.5: Diet adherence predictor model *

*STEP 2i.6: BMI predictor model *

*STEP 2i.7: Obese predictor model *

*Step 2i.8: Severely obese predictor model *

********************************************************************************;

*------

* STEP 2a. Program set up

*------;

*Dropping other programs of same name;

capture program drop gcompmediation;

*Specifying rclass program;

program define gcompmediation, rclass;

*------

* STEP 2b. Loading and sampling data

*------;

*Loading data;

use "$data\dep2_sdd_recoded_noshort.dta", clear;

*Draw race-stratified sample from dataset with replacement;

bsample, strata(model_race);

*------

* STEP 2c. Missing data imputation

*------;

*Duplicating variables under new name;

*This new variables will be replaced with imputed values;

foreach var in invbmi good_diet2 good_act cursmk ndi00_quar

hfe_quart ufe_quart age model_race assets10K unemploy incrat_cat

educat hhscat male marital_model born_us inlocd extlocd

popden_quart {;

gen i`var'=`var';

};

*Single stochastic imputation with chained equations;

*Set mi dataset style;

mi set flong;

*Clearing xtset;

mi xtset, clear;

*Registering imputed variables;

mi register imputed iinvbmi igood_diet2 igood_act icursmk

iassets10K iunemploy iborn_us iinlocd iextlocd indi00_quar

ihfe_quart iufe_quart imodel_race iincrat_cat ieducat

ihhscat imarital_model ipopden_quart;

*Imputing data;

mi impute chained

(regress) iinvbmi

(logit) igood_diet2 igood_act icursmk iassets10K

iunemploy iborn_us iinlocd iextlocd

(mlogit) indi00_quar ihfe_quart iufe_quart

imodel_race iincrat_cat ieducat ihhscat

imarital_model ipopden_quart = i.imale i.agecat,

add(1) rseed(123) replace augment force;

*MI diagnostics;

midiagplots iinvbmi, sample(all) plottype(kdensity)

title("Distribution of inverse BMI") ksmirnov

saving("$graphs\mi_iinvbmi_kdensity", replace);

midiagplots iinvbmi, sample(all) plottype(cumul)

title("Distribution of inverse BMI")

saving("$graphs\mi_iinvbmi_cumulative", replace);

midiagplots indi00_quar ihfe_quart iufe_quart imodel_race

iincrat_cat ieducat ihhscat imarital_model ipopden_quart

igood_diet2 igood_act icursmk iassets10K iunemploy iborn_us

iinlocd iextlocd, sample(all) ncategories(6);

*------

* STEP 2d. Keeping only imputed observations

*------;

*Dropping original observations and keeping only imputed

*observations;

drop if _mi_m==0;

*Saving imputation dataset;

save "$data\dep2_sdd_recoded_noshort_imp.dta", replace;

*------

*STEP 2e: Recreating analysis vars from imputed data

*------;

use "$data\dep2_sdd_recoded_noshort_imp.dta", clear;

*Transforming ibmi from iinvbmi;

gen ibmi=1/iinvbmi;

*Creating new obese variable;

gen iobese=(ibmi>=30);

replace iobese=. if ibmi==.;

*Creating new severe obese variable;

gen iobsev=(ibmi>=35);

replace iobsev=. if ibmi==.;

*NDI quartile dummies;

tab indi00_quar, gen(indi_qt);

replace indi_qt1=. if (indi00_quar==.);

label define indi_qt1 0 "NDI quartile > 1" 1 "NDI quartile 1";

label variable indi_qt1 "Imputed NDI qt 1 indicator";

label values indi_qt1 indi_qt1;

tab indi_qt1, m;

replace indi_qt2=. if (indi00_quar==.);

label define indi_qt2 0 "Not qt 2" 1 "NDI quartile 2";

label variable indi_qt2 "Imputed NDI qt 2 indicator";

label values indi_qt2 indi_qt2;

tab indi_qt2, m;

replace indi_qt3=. if (indi00_quar==.);

label define indi_qt3 0 "Not qt 3" 1 "NDI quartile 3";

label variable indi_qt3 "Imputed NDI Qt 3 indicator";

label values indi_qt3 indi_qt3;

tab indi_qt3, m;

replace indi_qt4=. if (indi00_quar==.);

label define indi_qt4 0 "NDI Quart <4" 1 "NDI Quart 4";

label variable indi_qt4 "Imputed NDI Qt 4 indicator";

label values indi_qt4 indi_qt4;

tab indi_qt4, m;

*Healthy food density quartile dummies;

tab ihfe_quart, gen(ihfe_qt);

*Unhealthy food density quartile dummies;

tab iufe_quart, gen(iufe_qt);

*UFE Quartile 4 vs. Quartile 1;

gen iufe_qt_4v1=.;

replace iufe_qt_4v1=1 if iufe_quart==4;

replace iufe_qt_4v1=0 if iufe_quart==1;

tab iufe_qt_4v1 iufe_quart, m;

*Population density quartile dummies;

tab ipopden_quart, gen(ipopden_qt);

*Race category dummies;

tab imodel_race, gen(irace);

label variable irace1 "White";

label variable irace2 "Black";

label variable irace3 "Latino";

label variable irace4 "Asian";

label variable irace5 "Other";

*Age category dummies;

gen agecat1=(age>=29 & age<52);

replace agecat1=. if age==.;

gen agecat2=(age>=52 & age<66);

replace agecat2=. if age==.;

gen agecat3=(age>=66);

replace agecat3=. if age==.;

*Education category dummies;

tab ieducat, gen(ieducat);

label variable ieducat1 "Imputed less than HS";

label variable ieducat2 "Imputed HS GED or technical";

label variable ieducat3 "Imputed Associates degree";

label variable ieducat4 "Imputed Bachelors degree";

label variable ieducat5 "Imputed Post-graduate degree";

*Income to poverty ratio dummies;

tab iincrat_cat, gen(iincrat_cat);

label variable iincrat_cat1 "Imputed income to poverty ratio 600+% FPL";

label variable iincrat_cat2 "Imputed income to poverty ratio 301-600% FPL";

label variable iincrat_cat3 "Imputed income to poverty ratio 100-300% FPL";

label variable iincrat_cat4 "Imputed income to poverty ratio <100% FPL";

*Household size;

tab ihhscat, gen(ihhscat);

label variable ihhscat1 "Imputed HH size 1";

label variable ihhscat2 "Imputed HH size 2";

label variable ihhscat3 "Imputed HH size 3";

label variable ihhscat4 "Imputed HH size 4";

label variable ihhscat5 "Imputed HH size 5";

label variable ihhscat6 "Imputed HH size 6 or more";

*Marital status;

tab imarital_model, gen(imarital_);

label variable imarital_1 "Imputed Married";

label variable imarital_2 "Imputed Divorced or separated";

label variable imarital_3 "Imputed Widowed";

label variable imarital_4 "Imputed Never married/single";

*------

*STEP 2f: Creating interaction terms

*------;

*NDI and income;

foreach x in indi_qt1 indi_qt2 indi_qt3 indi_qt4 {;

foreach y in iincrat_cat1 iincrat_cat2 iincrat_cat3

iincrat_cat4 {;

gen `x'`y'=`x'*`y';

};

};

*NDI and education;

foreach x in indi_qt1 indi_qt2 indi_qt3 indi_qt4 {;

foreach y in ieducat1 ieducat2 ieducat3 ieducat4 ieducat5 {;

gen `x'`y'=`x'*`y';

};

};

*NDI and population density;

foreach x in indi_qt1 indi_qt2 indi_qt3 indi_qt4 {;

foreach y in ipopden_qt1 ipopden_qt2 ipopden_qt3

ipopden_qt4 {;

gen `x'`y'=`x'*`y';

};

};

*NDI and good_diet;

foreach x in indi_qt1 indi_qt2 indi_qt3 indi_qt4 {;

foreach y in igood_diet2 {;

gen `x'`y'=`x'*`y';

};

};

*NDI and HFE;

foreach x in indi_qt1 indi_qt2 indi_qt3 indi_qt4 {;

foreach y in ihfe_qt1 ihfe_qt2 ihfe_qt3 ihfe_qt4 {;

gen `x'`y'=`x'*`y';

};

};

*NDI and race;

foreach x in indi_qt1 indi_qt2 indi_qt3 indi_qt4 {;

foreach y in irace1 irace2 irace3 irace4 irace5 {;

gen `x'`y'=`x'*`y';

};

};

*HFE and UFE;

foreach x in ihfe_qt1 ihfe_qt2 ihfe_qt3 ihfe_qt4 {;

foreach y in iufe_qt1 iufe_qt2 iufe_qt3 iufe_qt4 {;

gen `x'`y'=`x'*`y';

};

};

*UFE and race;

foreach x in iufe_qt1 iufe_qt2 iufe_qt3 iufe_qt4 {;

foreach y in irace1 irace2 irace3 irace4 irace5 {;

gen `x'`y'=`x'*`y';

};

};

*Race and external locus of control;

foreach x in iextlocd {;

foreach y in irace1 irace2 irace3 irace4 irace5 {;

gen `x'`y'=`x'*`y';

};

};

*Race and household size;

foreach x in irace1 irace2 irace3 irace4 irace5 {;

foreach y in ihhscat1 ihhscat2 ihhscat3 ihhscat4 ihhscat5

ihhscat6 {;

gen `x'`y'=`x'*`y';

};

};

*Race and assets;

foreach x in iassets10K {;

foreach y in irace1 irace2 irace3 irace4 irace5 {;

gen `x'`y'=`x'*`y';

};

};

*Race and marital status;

foreach x in imarital_1 imarital_2 imarital_3 imarital_4 {;

foreach y in irace1 irace2 irace3 irace4 irace5 {;

gen `x'`y'=`x'*`y';

};

};

*Gender and age;

foreach x in imale {;

foreach y in agecat1 agecat2 agecat3 {;

gen `x'`y'=`x'*`y';

};

};

*Gender and race;

foreach x in imale {;

foreach y in irace1 irace2 irace3 irace4 irace5 {;

gen `x'`y'=`x'*`y';

};

};

*Gender and education;

foreach x in imale {;

foreach y in ieducat1 ieducat2 ieducat3 ieducat4 ieducat5 {;

gen `x'`y'=`x'*`y';

};

};

*Gender and income;

foreach x in imale {;

foreach y in iincrat_cat1 iincrat_cat2 iincrat_cat3

iincrat_cat4 {;

gen `x'`y'=`x'*`y';

};

};

*Gender and internal locus of control;

foreach x in imale {;

foreach y in iinlocd {;

gen `x'`y'=`x'*`y';

};

};

*Gender and born in us;

foreach x in imale {;

foreach y in iborn_us {;

gen `x'`y'=`x'*`y';

};

};

*Gender and physical activity;

foreach x in imale {;

foreach y in igood_act {;

gen `x'`y'=`x'*`y';

};

};

*Education and race;

foreach x in ieducat1 ieducat2 ieducat3 ieducat4 ieducat5 {;

foreach y in irace1 irace2 irace3 irace4 irace5 {;

gen `x'`y'=`x'*`y';

};

};

*Education and household size;

foreach x in ieducat1 ieducat2 ieducat3 ieducat4 ieducat5 {;

foreach y in ihhscat1 ihhscat2 ihhscat3 ihhscat4 ihhscat5

ihhscat6 {;

gen `x'`y'=`x'*`y';

};

};

*Age and education;

foreach x in agecat1 agecat2 agecat3 {;

foreach y in ieducat1 ieducat2 ieducat3 ieducat4 ieducat5 {;

gen `x'`y'=`x'*`y';

};

};

*Age and race;

foreach x in agecat1 agecat2 agecat3 {;

foreach y in irace1 irace2 irace3 irace4 irace5 {;

gen `x'`y'=`x'*`y';

};

};

*Age and marital status;

foreach x in agecat1 agecat2 agecat3 {;

foreach y in imarital_1 imarital_2 imarital_3 imarital_4 {;

gen `x'`y'=`x'*`y';

};

};

*Age and income;

foreach x in agecat1 agecat2 agecat3 {;

foreach y in iincrat_cat1 iincrat_cat2 iincrat_cat3

iincrat_cat4 {;

gen `x'`y'=`x'*`y';

};

};

*Age and household size;

foreach x in agecat1 agecat2 agecat3 {;

foreach y in ihhscat1 ihhscat2 ihhscat3 ihhscat4 ihhscat5

ihhscat6 {;

gen `x'`y'=`x'*`y';

};

};

*Physical activity and current smoking;

foreach x in igood_act {;

foreach y in icursmk {;

gen `x'`y'=`x'*`y';

};

};

*Physical activity and race;

foreach x in igood_act {;

foreach y in irace1 irace2 irace3 irace4 irace5 {;

gen `x'`y'=`x'*`y';

};

};

*Physical activity and age;

foreach x in igood_act {;

foreach y in agecat1 agecat2 agecat3 {;

gen `x'`y'=`x'*`y';

};

};

*Physical activity and education;

foreach x in igood_act {;

foreach y in ieducat1 ieducat2 ieducat3 ieducat4 ieducat5 {;

gen `x'`y'=`x'*`y';

};

};

*Current smoking and education;

foreach x in icursmk {;

foreach y in ieducat1 ieducat2 ieducat3 ieducat4 ieducat5 {;

gen `x'`y'=`x'*`y';

};

};

*Current smoking and race;

foreach x in icursmk {;

foreach y in irace1 irace2 irace3 irace4 irace5 {;

gen `x'`y'=`x'*`y';

};

};

*Born_us and race;

foreach x in iborn_us {;

foreach y in irace1 irace2 irace3 irace4 irace5 {;

gen `x'`y'=`x'*`y';

};

};

*Born_us and education;

foreach x in iborn_us {;

foreach y in ieducat1 ieducat2 ieducat3 ieducat4 ieducat5 {;

gen `x'`y'=`x'*`y';

};

};

*Born_us and unemploy;

foreach x in iborn_us {;

foreach y in iunemploy {;

gen `x'`y'=`x'*`y';

};

};

*Born_us and age;

foreach x in iborn_us {;

foreach y in agecat1 agecat2 agecat3 {;

gen `x'`y'=`x'*`y';

};

};

*Unemploy and race;

foreach x in iunemploy {;

foreach y in irace1 irace2 irace3 irace4 irace5 {;

gen `x'`y'=`x'*`y';

};

};

*Unemploy and hhscat;

foreach x in iunemploy {;

foreach y in ihhscat1 ihhscat2 ihhscat3 ihhscat4 ihhscat5 {;

gen `x'`y'=`x'*`y';

};

};

*Unemploy and internal locus of control;

foreach x in iunemploy {;

foreach y in iinlocd {;

gen `x'`y'=`x'*`y';

};

};

*Unemploy and current smoking;

foreach x in iunemploy {;

foreach y in icursmk {;

gen `x'`y'=`x'*`y';

};

};

*Unemploy and physical activity;

foreach x in iunemploy {;

foreach y in igood_act {;

gen `x'`y'=`x'*`y';

};

};

*Internal locus of control and age;

foreach x in iinlocd {;

foreach y in agecat1 agecat2 agecat3 {;

gen `x'`y'=`x'*`y';

};

};

*Internal locus of control and education;

foreach x in iinlocd {;

foreach y in ieducat1 ieducat2 ieducat3 ieducat4 ieducat5 {;

gen `x'`y'=`x'*`y';

};

};

*Good_diet and race;