Presentation is loading. Please wait.

Presentation is loading. Please wait.

University of North Carolina at Chapel Hill

Similar presentations


Presentation on theme: "University of North Carolina at Chapel Hill"— Presentation transcript:

1 University of North Carolina at Chapel Hill
Using Stata Graphics as a Method of Understanding and Presenting Interaction Effects Joanne M. Garrett, PhD University of North Carolina at Chapel Hill July 11, 2005

2 Problems with Understanding Interaction
Interaction difficult concept to explain not a single answer (point estimate) linear combination of betas Often ignored because of difficulty Graph of interaction may be more intuitive for: students learning the concept presentations at professional meetings

3 Low Birth Weight Study*
Variable Description Coding low Low birth weigh 1 = ≤ 2500 gms 0 = >2500 gms bwt Birth weight grams smk Smoked during pregnancy 1 = smoked 0 = did not smoke race Mother’s race 1 = black 0 = white age Mother’s age years * “Loosely” adapted from data from Applied Logistic Regression, David W. Hosmer, Jr. and Stanley Lemeshow

4 Example 1: Low birth weight and interaction between smoking and race (1=black, 0=white)
Logistic regression model: Add smk by race interaction Create interaction term and run logistic regression: . gen smkxrace = smk * race . logistic low smk race smkxrace

5 Example 1: Low birth weight and interaction between smoking and race (1=black, 0=white)
low | OR z P>|z| [95% CI] smk | race | smkxrace | Significant interaction: Relationship differs between smoking and low birth wt depending on mother’s race Question: How to interpret the interaction OR?

6 Example 1: Low birth weight and interaction between smoking and race (1=black, 0=white)
Convert OR’s to beta coefficients and solve by categories of race: . logit low | Coef z P>|z| [95% CI] smk | race | smkxrace | _cons| White: OR = e [β1 + β3(race)] = e [1.751 – 1.141(0)] = 5.76 Black: OR = e [β1 + β3(race)] = e [1.751 – 1.141(1)] = 1.84

7 Example 1: Low birth weight and interaction between smoking and race (1=black, 0=white)
White: . lincom smk + 0*smkxrace low | OR z P>|z| [95% CI] (1) | Black: . lincom smk + 1*smkxrace (1) |

8 Example 1: Low birth weight and interaction between smoking and race (1=black, 0=white)
Interpretation: Among whites, women who smoke have 5.8 times the odds of having a low birth wt baby Among blacks, there is no relationship between smoking and having a low birth wt baby (OR=1.8, but not statistically significant)

9 Example 1: Low birth weight and interaction between smoking and race (1=black, 0=white)
Misinterpretations: Black mothers have less “risk” for low birth wt babies compared to white mothers It’s okay for black mothers to smoke Alternative: Solve the equation for values of smk and race Graph the individual probabilities (“predxcat”) . predxcat low, xvar(race smk) graph bar

10 Example 1: Low birth weight and interaction between smoking and race (1=black, 0=white)
| race smk numobs prob lower upper | | | | 0:White 0:No | | 0:White 1:Yes | | 1:NonWh 0:No | | 1:NonWh 1:Yes | Likelihood ratio test of interaction for race * smk: LR Chi2(1) = Prob > Chi2 =

11 Example 1: Low birth weight and interaction between smoking and race (1=black, 0=white)

12 Example 2: Low birth weight and interaction between smoking and age (years)
Logistic regression model: Add smk by age interaction Create interaction term and run logistic regression: . gen smkxage = smk * age . logistic low smk age smkxage

13 Example 2: Low birth weight and interaction between smoking and age (years)
low | OR z P>|z| [95% CI] smk | age | smkxage | Significant interaction: Relationship differs between smoking and low birth wt depending on mother’s age Question: How to interpret the interaction OR for a continuous interaction variable?

14 Example 2: Low birth weight and interaction between smoking and age (years)
Convert OR’s to beta coefficients and solve for selected values of age: . logit low | Coef. z P>|z| [95% CI] smk | age | smkxage | _cons| Age=15: OR = e [β1 + β3(age)] = e [– (15)] = 1.14 Age=35: OR = e [β1 + β3(age)] = e [– (35)] = 4.93

15 Example 2: Low birth weight and interaction between smoking and age (years)
Age=15: . lincom smk + 15*smkxage low | OR z P>|z| [95% CI] (1) | Age=35: . lincom smk + 35*smkxage low | OR z P>|z| [95% CI] (1) |

16 Example 2: Low birth weight and interaction between smoking and age (years)
Interpretation: Among 15 year olds, women who smoke have 1.1 times the odds of having a low birth wt baby Among 35 year olds, women who smoke have 4.9 times the odds of having a low birth wt baby

17 Example 2: Low birth weight and interaction between smoking and age (years)
Misinterpretations: 15 year olds are not at risk for low birth wt babies It’s okay for 15 year olds to smoke Alternative: Solve the equation and graph the probabilities for different levels of smoke and age (“predxcon”) . predxcon low, xvar(age) from(15) to(35) inc(2) class(smk) graph

18 Example 2: Low birth weight and interaction between smoking and age (years)
-> smk = 0 | age pred_y lower upper | | | | | | | | | | (etc) | -> smk = 1 | | | | Likelihood ratio test for interaction of age * smk: LR Chi2(1) = Prob > Chi2 =

19 Example 2: Low birth weight and interaction between smoking and age (years)

20 Example 3: Birth weight (grams) and interaction between smoking and race
Linear regression model: Create interaction term and run linear regression: . gen smkxrace = smk * race . regress low smk race smkxrace Or: . predxcat bwt, xvar(race smk) graph bar

21 Example 3: Birth weight (grams) and interaction between smoking and race

22 Example 4: Birth weight (grams) and interaction between smoking and age
Linear regression model: Create interaction term and run linear regression: . gen smkxage = smk * age . regress low smk age smkxage Or: . predxcon bwt, xvar(age) from(15) to(35) inc(2) class(smk) graph

23 Example 4: Birth weight (grams) and interaction between smoking and age

24 Example 5: Birth weight (grams) and interaction between smoking and age, age2, age3
Linear regression model: add quadratic & cubic terms Create interaction terms and run linear regression: . gen age2 = age^2 . gen age3 = age^3 . gen smkxage = smk * age . gen smkxage2 = smk * age2 . gen smkxage3 = smk * age3 . regress low smk age age2 age3 smkxage smkxage2 smkxage3 Or: . predxcon bwt, xvar(age) from(15) to(35) inc(2) class(smk) graph poly(3)

25 Example 5: Birth weight (grams) and interaction between smoking and age, age2, age3

26 Conclusions Interaction can be a difficult concept for people unfamiliar with the methodology Examining a graph of an interaction is an easier way to get an intuitive feel for the effect A useful technique for explaining interaction to students hearing it for the first time, before introducing mathematical models A simple way to present study results at meetings, even to a statistically savvy audience

27

28 Calculating and Graphing Predicted Values: (when “X” is categorical)
. predxcat yvar, xvar(xvar1 xvar2) yvar – dependent variable continuous – defaults to linear regression binary (0,1) – defaults to logistic regression xvar(xvar) – nominal variable for categories of estimated means or proportions xvar(xvar1 xvar2) – categories of all combinations of xvar1 and xvar2; tests interaction adjust(cov_list) – adjusts for any covariates

29 Calculating and Graphing Predicted Values: (when “X” is categorical)
graph – display graph (otherwise shows list of predicted values only) bar – bar graph (instead of symbols – default) model – for display purposes only; displays regression model Some other options: level(#) cluster(cluster_id) savepred(ds_name)

30 Calculating and Graphing Predicted Values: (when “X” is continuous)
. predxcon yvar, xvar(xvar) from(#) to(#) inc(#) graph yvar – dependent variable continuous – defaults to linear regression binary (0,1) – defaults to logistic regression xvar(xvar) – continuous independent variable; probabilities calculated for each value of X from(#) – bottom value for xvar to(#) – top value for xvar inc(#) – increment desired between bottom and top values adjust(cov_list) – adjusts for any covariates

31 Calculating and Graphing Predicted Values: (when “X” is continuous)
graph – display graph (otherwise shows list of predicted values only) class(class_var) – adds an xvar by class_var interaction term poly(2 or 3) – polynomial terms added: 2=squared =squared and cubic model – for display purposes only; displays regression model Some other options: level(#) cluster(cluster_id) nolist savepred(ds_name)


Download ppt "University of North Carolina at Chapel Hill"

Similar presentations


Ads by Google