Doing Analyses on Binary Outcome

46
Doing Analyses on Binary Outcome

description

Doing Analyses on Binary Outcome. From November 14 th. Dr Sainani talked about how the math works for binomial data. Binomial Code. There is some SAS code on the website to show how to play around with binomial probabilities. Run the macro code first that is the part from: - PowerPoint PPT Presentation

Transcript of Doing Analyses on Binary Outcome

Page 1: Doing Analyses on Binary Outcome

Doing Analyses on Binary Outcome

Page 2: Doing Analyses on Binary Outcome

From November 14th

• Dr Sainani talked about how the math works for binomial data.

Page 3: Doing Analyses on Binary Outcome

Binomial Code

• There is some SAS code on the website to show how to play around with binomial probabilities. Run the macro code first that is the part from:

%macro binom(events, trials, prob);• down to

%mend;• Then you just plug in the number of events, trials

and probability and run this line:• %binom(3, 5, .5);

Page 4: Doing Analyses on Binary Outcome

Results

• The code kicks out two summary tables. One has descriptive statistics and the binomial probabilities plus a couple checks on whether or not you can use Z approximations of the confidence limits.

• Plug in several examples from the lecture on the 12th and 14th to validate the code.

Page 5: Doing Analyses on Binary Outcome

Results(2)

• The code also give you the confidence limits around the probability:

• Search the SAS online documentation for proc reliability to see the details on the CLS and setting your own limits if you want say 90% CLs.

support.sas.com/onlinedoc/913/docMainpage.jsp

Page 6: Doing Analyses on Binary Outcome
Page 7: Doing Analyses on Binary Outcome

The Easy Answer

• Once the macro has been run once you just need to run this line:

%binom(2, 6, .551);

Page 8: Doing Analyses on Binary Outcome

Math Stuff

DC

C

BA

APP propbetween Diff 21

DCC

BAA

P

P Risk Relative

2

1

B

A

B)(AB

B)(AA

exposedin disease of Odds

D

C

D)(CD

D)(CC

unexposedin disease of Odds

DC

BA

unexposedin disease of Odds

exposedin diseased of Odds

Page 9: Doing Analyses on Binary Outcome

Difference in Proportion Math

DC

C

BA

APP propbetween Diff 21

2

22

1

11

N

)P1(P

N

)P1(P of SE

95% CI on the Difference = (Δ – 1.96 * SE) up to (Δ + 1.96 * SE)

Page 10: Doing Analyses on Binary Outcome

RR Math

DCC

BAA

P

P Risk Relative

2

1

DC

D/C

BA

B/A1.96 ln(RR) ln(RR) of CI 95%

Page 11: Doing Analyses on Binary Outcome

OR Math

B

A

B)(AB

B)(AA

exposedin disease of Odds

D

C

D)(CD

D)(CC

unexposedin disease of Odds

DC

BA

unexposedin disease of Odds

exposedin diseased of Odds

D

1

C

1

B

1

A

11.96 ln(OR) of CI 95%

Page 12: Doing Analyses on Binary Outcome

Ummm… No Thanks

• If you don’t want to do the algebra by hand you don’t have to. SAS has can do all this work for you easily.

Page 13: Doing Analyses on Binary Outcome

Relative Risks

• If you use SAS for analyses be sure to set your tables up correctly. You will recall that Dr. Sainani showed this take with a RR of 1.61

  Smoker (E) Non-smoker (~E)

 

Heart disease (D)

21 13

No Disease (~D) 79 87

  100 100

Page 14: Doing Analyses on Binary Outcome

Making the table

• There is an EG project showing how to make the data:

Page 15: Doing Analyses on Binary Outcome

A Contingency Table

• Contingency table values have to be mutually exclusive counts.

Swap these for real life!!!!!

Page 16: Doing Analyses on Binary Outcome

Getting a Relative Risk (sort of)

• It does not give you the RR!

Page 17: Doing Analyses on Binary Outcome

Rotate the table

• The risk factor was in the first column.

• Notice it is the same odds ratio.

Page 18: Doing Analyses on Binary Outcome

Risk Differences

%8%13%21)~/()/( EDPEDP

  Smoker (E) Non-smoker (~E)

 

Heart disease (D)

21 13

No Disease (~D) 79 87

  100 100

Page 19: Doing Analyses on Binary Outcome

Risk Difference

Page 20: Doing Analyses on Binary Outcome

Association

Page 21: Doing Analyses on Binary Outcome

Expected values in Chi Square

• Which cells are above or below the expected values?

Page 22: Doing Analyses on Binary Outcome

R Version

• This does a quick analysis then deletes the table. Rerun the code to keep the table.

Page 23: Doing Analyses on Binary Outcome

Rerun these

Page 24: Doing Analyses on Binary Outcome
Page 25: Doing Analyses on Binary Outcome

Another Example

• This example is taken from Motulsky’s Intuitive Biostatistics (a book I highly recommend when you encounter people who HATE math).

• The data is from Cooper et al’s zidovudine (AZT) trial for people who are HIV+.– 76 of 475 on AZT had disease progress– 129 of 461 on placebo had disease progress

nprogressio ofrisk .5718%98.27

%16

Page 26: Doing Analyses on Binary Outcome

The effect

• 76/475 or 16% progression vs. 129/461 or 28%. Is the 12% reduction a significant difference?

Page 27: Doing Analyses on Binary Outcome

Grouped Data

Page 28: Doing Analyses on Binary Outcome

The percents you care about

The difference you care about

The bad thing is in column 1

nprogressio ofrisk .5718%98.27

%16

Page 29: Doing Analyses on Binary Outcome

Important stuff

• Your subjects have to be randomly selected (independent from each other) from the population you wish to generalize to and the only differences between the two groups should be exposure to the risk factor (in a cohort study) or treatment (in a trial).

Page 30: Doing Analyses on Binary Outcome

Beyond the Relative Risk

• Epidemiologists get very excited about relative risks but look at the overall prevalence.– A risk factor that changes the risk from 1 in

1,000,000 to 2 in 1,000,000 is not too important compared to a risk factor that changes the risk from 1 in 10 to 2 in 10 but the relative risk is the same. The relative risk is the same .5 for both risk factors.

Page 31: Doing Analyses on Binary Outcome

NNT• The number needed to treat (NNT) is the

reciprocal of the difference in the probabilities between the two groups. It gives you a metric to judge the relative importance of the effects. In this case you need to treat a million people to made a difference in the rare disease vs 10.

Risk of 1 in 1,000,000 =Risk of 2 in 2,000,000 =

Page 32: Doing Analyses on Binary Outcome

AZTon people #

AZTon gprogressin people #

Probability vs Odds

• So far I have talked about probabilities using the number of people progressing while on AZT relative to all the people on it.

• You can also look at odds by make a ratio of people progressing while on AZT to those who are not progressing on AZT

• Odds are not easy to think about and because of this not ideal for this data.

AZTon gprogressinnot people #

AZTon gprogressin people #

Page 33: Doing Analyses on Binary Outcome

Relative Risk vs. Odds Ratio

• Relative Risk

• Odds Ratio

Placeboon gprogressinnot people #Placeboon gprogressin people #

AZTon gprogressinnot people #AZTon gprogressin people #

Placeboon people #Placeboon gprogressin people #

AZTon people #AZTon gprogressin people #

Page 34: Doing Analyses on Binary Outcome

Why mess around with odds?

• If your disease/outcome of interest is rare you will not want to study hundreds of thousands of exposed people to find the few who get disease.

• You will want to find people with disease and match them to controls and then look to see if they were exposed. – This is a retrospective case-control study.

Page 35: Doing Analyses on Binary Outcome

Dangers of RR

• You can get any relative risk you want by sampling different numbers of cases and controls in the case-control study!

Page 36: Doing Analyses on Binary Outcome

Get 100 times the controlsGet 100 times the cases

The original study of cat scratch fever

Page 37: Doing Analyses on Binary Outcome

Rare diseases

• If the disease is rare then the odds ratio approximates the relative risk.

DC

BA

Ratio Odds

DCC

BAA

P

P Risk Relative

2

1

Page 38: Doing Analyses on Binary Outcome

Case Control

• Finding the right controls is VERY tricky. Take a class in epidemiology from Dr. Rita Popat to learn about the problems associated with the different types of controls.

Page 39: Doing Analyses on Binary Outcome

Contingency Table Analyses

• You have seen contingency tables used to describe many kinds of studies.– Experiments– Cohorts– Case-Control studies

• Contingency tables are also used to describe results of lab results.– You will see a new test which calls people sick or not

sick and you will have a gold standard. You want statistics to describe how good the new test does.

Page 40: Doing Analyses on Binary Outcome

Screening and Diagnostic

• Sensitivity - correctly calling people sick when they are.

• Specificity - correctly calling people healthy when they are.

• Predictive value of a positive test - the percentage of people who are positive given a positive test result

• Predictive value of a negative test - the percentage of people who are negate given a negative test result.

Page 41: Doing Analyses on Binary Outcome

Testing Formals

sensitivity = 100 * a /(a+c)

specificity = 100 * d / (b+d)

predictive value of positive = 100 * a/(a+b)

predictive value of negative = 100 * d/(c+d)

• Given half a chance I will mess up the algebra so I wrote code to do it.

Disease(+) Not Diseased (-)a b

true + false +c d

false - true --

+

Reality

Te

st r

esu

lt

Page 42: Doing Analyses on Binary Outcome

Reading from the Bible

• Fleiss wrote the authoritative book on categorical data analysis (Statistical Methods for Rates and Proportions, 3rd Edition 2003 Fleiss, Levin, Paik). Get a copy if you are going to deal with categorical data in real life. I have coded up a lot of the book so you don’t need to think how to code up what goes with the brilliant prose. www.stanford.edu/class/hrp223/2003/Fleiss/

Page 43: Doing Analyses on Binary Outcome

Using the Code

Page 44: Doing Analyses on Binary Outcome

McNemar’s Test

• If you have pairs of matched data points (husband and wife saying yes/no, right eye vs. left eye vision good yes/no) you will want to measure the association considering that the pairs of data points are related.

• You can do McNemar’s test to see if there is an association in the paired data.

Page 45: Doing Analyses on Binary Outcome
Page 46: Doing Analyses on Binary Outcome

Agreement

• If you want to look at the degree of agreement between two raters you need a statistic that considers how frequently the people would agree by chance alone. You use the same SAS or EG code.