Presentation is loading. Please wait.

Presentation is loading. Please wait.

Basic epidemiologic analysis with Stata Biostatistics 212 Lecture 5.

Similar presentations


Presentation on theme: "Basic epidemiologic analysis with Stata Biostatistics 212 Lecture 5."— Presentation transcript:

1 Basic epidemiologic analysis with Stata Biostatistics 212 Lecture 5

2 Housekeeping Pickup your Lab 1’s… Questions about Lab 3 or Lab 4? –Boolean statements and missing values –Protect/unprotect demo No answer keys to be posted Forum – useful? Who has “viewed” a response and gotten an answer? Extra credit puzzle Final Project – by the last session you should: –Have dataset imported into Stata –Clean up the variables you will use –Sketch out (paper and pencil) a table and a figure –Be ready to write analysis do files

3 Today... Stata as a tool for learning concepts Interaction and confounding with 2 x 2’s Stata’s “Epitab” commands Adjusting for many things at once Logistic regression Testing for trends

4 Stata: A tool for understanding theory Hands on vs. theoretical teaching –Use Stata to get your hands on the data See the dataset Write the command See the output Lab 1: Exposure to basic stats Today: Exposure to basic epi concepts –Confounding and interaction

5 Confounding and Interaction Practical questions –What is confounding? –What does it mean to “adjust” for something? –When to adjust and what to adjust for? –When to stratify? –What do the adjusted estimates mean?

6 An Example Does binge drinking cause atherosclerosis? RQ: Is there an association between self- reported binge drinking and presence of coronary calcium among young adults? –CARDIA Year 15 examination

7 An Example Yes! –RR = 1.9 (1.6 – 2.4), p<.001

8 An Example Yes! –RR = 1.9 (1.6 – 2.4), p<.001 Coronary calcium is present 1.9 times more commonly in persons who report binge drinking –But does binge drinking CAUSE atherosclerosis?

9 An Example Possible explanations* –Chance –Bias –Effect-cause –Confounding –Cause-effect * Hulley et al. Designing Clinical Research

10 An Example Possible explanations –Chancevery unlikely –Biaspossible – not focus here! –Effect-causeunlikely? –ConfoundingYES! –Cause-effect?

11 An Example Definition of a confounder

12 An Example Definition of a confounder –Associated with the predictor and a cause of the outcome (and NOT a mediator)

13 An Example Male gender Binge drinking Coronary calcium Male ?

14 An Example Male gender Now what do we do?? Binge drinking Coronary calcium Male ?

15 2 x 2 Tables Practical tools –“Contingency tables” are a traditional analytic tool of the epidemiologist Outcome Exposure ab cd OR = (a/b) /(c/d) = ad/bc RR = a/(a+b) / c/(c+d)

16 2 x 2 Tables Example Coronary calcium Binge drinking OR = 2.1 (1.6 – 2.7) RR = 1.9 (1.6 – 2.4)

17 2 x 2 Tables Example Coronary calcium Binge drinking OR = 2.1 (1.6 – 2.7) RR = 1.9 (1.6 – 2.4) Can we say that binge drinking CAUSES atherosclerosis?

18 2 x 2 Tables Is male gender a confounder? Binge drinking Coronary calcium Male ?

19 2 x 2 Tables Men more likely to binge –34% of men, 14% of women Men have more coronary calcium –15% of men, 7% of women

20 2 x 2 Tables Is it a mediator? –(intermediate step along the causal pathway) Binge drinking Coronary calcium Male ?

21 2 x 2 Tables Is it a mediator? –(intermediate step along the causal pathway) No Binge drinking Coronary calcium Male ?

22 2 x 2 Tables But what does confounding look like in contingency tables? And how do you adjust for it?

23 2 x 2 Tables But what does confounding look like in contingency tables? And how do you adjust for it? –Stratify –Examine strata-specific estimates (for interaction) –Combine estimates if appropriate (if no interaction) Weighted average of strata-specific estimates

24 2 x 2 Tables First, stratify… CAC Binge CAC Binge CAC Binge In menIn women RR = 1.94 ( ) (34%)(14%) (15%)(7%) RR = 1.57 ( )RR = 1.50 ( )

25 2 x 2 Tables …compare strata-specific estimates… (they’re about the same) CAC Binge CAC Binge In menIn women (34%)(14%) (15%)(7%) RR = 1.57 ( )RR = 1.50 ( )

26 2 x 2 Tables …and then “combine” the estimates CAC Binge CAC Binge In menIn women RR = 1.50 ( )RR = 1.57 ( ) RRadj = 1.51 ( )

27 Binge CAC Binge CAC Binge In menIn women (34%)(14%) (15%)(7%) RR = 1.57 ( )RR = 1.50 ( ) RR = 1.94 ( ) RRadj = 1.51 ( )

28 2 x 2 Tables How do we do this with Stata? –Tabulate – output not exactly what we want. –The “epitab” commands Stata’s answer to stratified analyses cs, cc csi, cci tabodds, mhodds

29 2 x 2 Tables Example – demo using Stata cs cac binge cs cac binge, by(male) cs cac modalc cs cac modalc, by(racegender) cc cac binge

30 2 x 2 Tables Example of a crude association (unadjusted). cs cac binge | Binge pattern [>5 drinks| | on occasion] | | Exposed Unexposed | Total Cases | | 292 Noncases | | Total | | 3042 | | Risk | | | | | Point estimate | [95% Conf. Interval] | Risk difference | | Risk ratio | | Attr. frac. ex. | | Attr. frac. pop | | chi2(1) = Pr>chi2 =

31 2 x 2 Tables Example of Confounding. cs cac binge, by(male) male | RR [95% Conf. Interval] M-H Weight | | Crude | M-H combined | Test of homogeneity (M-H) chi2(1) = Pr>chi2 =

32 2 x 2 Tables Example of Effect Modification. cs cac modalc, by(racegender) racegender | RR [95% Conf. Interval] M-H Weight Black women | White women | Black men | White men | Crude | M-H combined | Test of homogeneity (M-H) chi2(3) = Pr>chi2 =

33 2 x 2 Tables Inmediate commands –csi, cci –No dataset required – just 2x2 cell frequencies csi a b c d csi (for cac binge)

34 Multivariable adjustment Binge drinking appears to be associated with coronary calcium –Association partially due to confounding by gender What about race? Age? SES? Smoking?

35 Multivariable adjustment manual stratification # 2x2 tables Crude association1 Adjust for gender2 Adjust for gender, race4 Adjust for gender, race, age68 Adjust for “” + income, education816 Adjust for “” + “” + smoking2448

36 Multivariable adjustment cs command cs command –Does manual stratification for you Lists results from every strata Tests for overall homogeneity Adjusted and crude results –Demo cs cac binge, by(male black age)

37 Multivariable adjustment cs command cs command –Does manual stratification for you Lists results from every strata Tests for overall homogeneity Adjusted and crude results –Demo cs cac binge, by(male black age) –Can’t interpret interactions!

38 Multivariable adjustment mhodds command mhodds allows you to look at specific interactions, adjusted for multiple covariates –Does same stratification for you –Adjusted results for each interaction variable –P-value for specific interaction (homogeneity) –Summary adjusted result Demo mhodds cac binge age, by(racegender)

39 Multivariable adjustment mhodds command mhodds allows you to look at specific interactions, adjusted for multiple covariates –Does same stratification for you –Adjusted results for each interaction variable –P-value for specific interaction (homogeneity) –Summary adjusted result Demo mhodds cac binge age, by(racegender) But strata get thin!

40 Multivariable adjustment logistic command Assumes logit model –Await biostats class for details! –Coefficients estimated, no actual stratification –Continuous variables used as they are

41 Multivariable adjustment logistic command Basic syntax: logistic outcomevar [predictorvar1 predictorvar2 predictorvar3…]

42 Multivariable adjustment logistic command If using any categorical predictors: logistic outcomevar [i.catvar var2…] Creates “dummy variables” on the fly If you forget, Stata won’t know they are categorical, and you’ll get the wrong answer!

43 Multivariable adjustment logistic command Demo logistic cac binge logistic cac binge male logistic cac binge male black logistic cac binge male black age logistic cac binge male black age i.smoke logistic cac binge##i.racegender age i.smoke logistic cac modalc##racegender

44 Multivariable adjustment logistic command Demo. logistic cac binge male black age i.smoke Logistic regression Number of obs = 3036 LR chi2(6) = Prob > chi2 = Log likelihood = Pseudo R2 = cac | Odds Ratio Std. Err. z P>|z| [95% Conf. Interval] binge | male | black | age | | smoke | 1 | |

45 logistic command interaction demo. logistic cac modalc##racegender age i.smoke Logistic regression Number of obs = 2795 LR chi2(10) = Prob > chi2 = Log likelihood = Pseudo R2 = cac | Odds Ratio Std. Err. z P>|z| [95% Conf. Interval] modalc | | racegender | 2 | | | | modalc#| racegender | 1 2 | | | | age | | smoke | 1 | |

46 Multivariable adjustment logistic command Pro’s –Provides all OR’s in the model –Accepted approach ( mhodds rarely used by statisticians) –Can deal with continuous variables (like age) –Better estimation for large models? Con’s –Interaction testing more cumbersome, less automatic –More assumptions –Harder to test for trends

47 Multivariable adjustment Format for linear regression, and other types of regression is the same as for logistic regression, except for the initial command: regress outcomevar [predictorvar1 predictorvar2 predictorvar3…] ologit outcomevar [predictorvar1 predictorvar2 predictorvar3…] etc

48 For trends in a dichotomous variable with “higher” categories of an ordinal categorical variable. tabodds cac alccat alccat | cases controls odds [95% Conf. Interval] | <1 | | | Test of homogeneity (equal odds): chi2(3) = Pr>chi2 = Score test for trend of odds: chi2(1) = Pr>chi2 = Testing for trends tabodds command

49 Adjustment for multiple variables possible. tabodds cac alccat, adjust(age male black) Mantel-Haenszel odds ratios adjusted for age, male and black alccat | Odds Ratio chi2 P>chi2 [95% Conf. Interval] | <1 | | | Score test for trend of odds: chi2(1) = Pr>chi2 = Testing for trends tabodds command

50 Approaching your analysis Number of potential models/analyses is daunting –Where do you start? How do you finish? My suggestion –Explore –Plan definitive analysis, make dummy tables/figures –Do analysis (do/log files), fill in tables/figures –Show to collaborators, reiterate prn –Write paper

51 Summary Make sure you understand confounding and interaction with 2x2 tables in Stata Epitab commands are a great way to explore your data –Emphasis on interaction Logistic regression is a more general approach, ubiquitous, but testing for interactions and trends is more difficult

52 In lab today… Lab 5 –Epi analysis of coronary calcium dataset –Walks you through evaluation of confounding and interaction Judgment calls – often no right answer. Focus on reasoning! Reminder – put your answers as comments in the do file * 15c – 15%, p<.001

53 Next week Tables and Figures


Download ppt "Basic epidemiologic analysis with Stata Biostatistics 212 Lecture 5."

Similar presentations


Ads by Google