Docsity

Solved Problems - Categorical Data Analysis | PUBHLTH 640, Exams of Community Health

Toggle sidebar
bg1
PubHlth 640 Intermediate Biostatistics 1
Unit 4 – Categorical Data Analysis
Practice Problems - Week #5
SOLUTIONS
#1. Source: Fisher LD and VanBelle G. Biostatistics: A Methodology for the Health Sciences
New York: John Wiley, 1993. Chapter 6 Problem #12, page 234.
1A. Compute odds ratios and 95% confidence intervals for the four tables
Child
Birth Order SIDS Control
> 1 201 689
=1 92 626
Answer: OR = 1.985 95% CI = (1.52, 2.599)
Solution by Hand:
1. Obtain OR and ln(OR)
ad (201)(626)
ˆ
OR= 1.9850
bc (92)(689)
== Æ
ˆ
ln(OR) = ln(1.9850) = 0.6856
2. Obtain var(ln[OR]) and se(ln[OR])
111 1
ˆ
ˆ
var(ln[OR]) .0189
201 92 689 626
≈+++ = Æ ˆˆ
ˆˆ
se(ln[OR])= var(ln[OR]) .0189 0.1375≈=
3. Obtain 95% CI for ln[OR]
.6856-1.96 .0189 ln(OR) .6856+1.96 .0189≤≤ = (0.4161, 0.9551)
4. Exponentiate to obtain 95% CI for OR
( exp[.4161] , exp[.9551] ) = ( 1.5161, 2.5988 )
Solution using (http://statpages.org/ctab2x2.html):
Wk5_solutions.doc
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Solved Problems - Categorical Data Analysis | PUBHLTH 640 and more Exams Community Health in PDF only on Docsity!

Unit 4 – Categorical Data Analysis

Practice Problems - Week

SOLUTIONS

#1. Source: Fisher LD and VanBelle G. Biostatistics: A Methodology for the Health Sciences

New York: John Wiley, 1993. Chapter 6 Problem #12, page 234.

1A. Compute odds ratios and 95% confidence intervals for the four tables

Child

Birth Order SIDS Control

Answer: OR = 1.985 95% CI = (1.52, 2.599)

Solution by Hand:

1. Obtain OR and ln(OR)

ˆ^ ad^ (201)(626)

OR= 1.

bc (92)(689)

= = Æ ln(OR) = ln(1.9850) = 0.6856ˆ

2. Obtain var(ln[OR]) and se(ln[OR])

ˆ^1 1 1

var(ln[OR])ˆ.

≈ + + + = Æ se(ln[OR])=ˆ^ ˆ^ var(ln[OR])ˆ ˆ ≈ .0189 =0.

3. Obtain 95% CI for ln[OR]

.6856-1.96 .0189 ≤ ln(OR) ≤ .6856+1.96 .0189 = (0.4161, 0.9551)

4. Exponentiate to obtain 95% CI for OR

( exp[.4161] , exp[.9551] ) = ( 1.5161, 2.5988 )

Solution using (http://statpages.org/ctab2x2.html):

Child

Maternal Age SIDS Control

Answer: OR = 2.458 95% CI = (1.81, 3.34)

Solution using (http://statpages.org/ctab2x2.html):

Child

SIDS Control

Birth order > 1

and Maternal Age < 19

Birth order = 1

OR Maternal Age > 19

Answer: OR = 7.435 95% CI = (4.012, 13.774)

Solution using (http://statpages.org/ctab2x2.html):

Child

SIDS Control

Birth order > 1

and Maternal Age < 19

Birth order = 1

AND Maternal Age > 19

Answer: OR = 17.443 95% CI = (8.827, 34.469)

Solution using (http://statpages.org/ctab2x2.html):

Cups Coffee per day MI Control

25-34 CIGARETTES/DAY

Cups Coffee per day MI Control

35-44 CIGARETTES/DAY

Cups Coffee per day MI Control

45+ CIGARETTES/DAY

Cups Coffee per day MI Control

A. Compute the Mantel Haenszel estimate of the odds ratio.

Solution in Excel

Worksheet for problem 2A

a b c d T ad/T bc/T

Totals: 58.95374 46.

OR(MH) = 1.

Solution in STATA

Comments are in bold blue and begin with an asterisk Commands to are in bold black

. set more off . * Use drop down menu (FILE > OPEN) to open data . use "/Users/carolbigelow/Desktop/week5_2009.dta" . * Use command DESCRIBE to look at variable names . describe

Contains data from /Users/carolbigelow/Desktop/week5_2009.dta obs: 28 vars: 5 28 Apr 2006 16: size: 364 (99.9% of memory free)


storage display value variable name type format label variable label


cigs byte %16.0g cigsf Cigarettes per day coffee byte %8.0g coffee per day micase byte %8.0g heart attack case tally int %8.0g wgt float %9.0g


. * Solution for Question # . * Preliminary is to use the command SORT to sort the data by cigs . sort cigs . * Use command MHODDS to obtain an Mantel Haenszel stratified analysis of rates . * Obtain Mantel Haenszel OR and Test of Homogeneity . mhodds micase coffee [freq=tally], by(cigs)

Maximum likelihood estimate of the odds ratio Comparing coffee==1 vs. coffee== by cigs

cigs | Odds Ratio chi2(1) P>chi2 [95% Conf. Interval] ----------+-------------------------------------------------------------------- 1=never | 10.752493 44.90 0.0000 4.504986 25. 2=former | 2.177778 2.42 0.1197 0.796941 5. 3=1-14 c | 0.097222 19.81 0.0000 0.027168. 4=15-24 | 1.737374 4.78 0.0288 1.052085 2. 5=25-34 | 1.558333 1.80 0.1798 0.810685 2. 6=35-44 | 1.186364 0.25 0.6139 0.610313 2. 7=45+ ci | 0.882353 0.09 0.7693 0.382028 2.


Mantel-Haenszel estimate controlling for cigs

Odds Ratio chi2(1) P>chi2 [95% Conf. Interval]

1.274028 3.40 0.0651 0.984318 1.

B. Compute the appropriate chi square test for association.

Answer: The test for homogeneity of proportions is significant (Chi square on df=6 is 63.47;

p-value < .0001), suggesting that estimation of a coffee-MI association is different

depending on level of cigarette smoking.

For completeness, the test of departure of the Mantel Haenszel OR from the null

value of unity is marginally significant (Chi square on df = 1 is 3.40; p-value = .07)

The appropriate analysis would assess, first, the homogeneity of the stratum specific odds ratios.

Looking at the stratum-specific estimated odds ratios in the STATA output above suggests that they

are not equal. If true, the appropriate analysis concludes that the association between myocardial

infarction and coffee consumption is modified by cigarette smoking.

Solution in STATA

STATA command is the same.

. * Obtain Mantel Haenszel OR . mhodds micase coffee [freq=tally], by(cigs)

… some output omitted as it appears above …

Mantel-Haenszel estimate controlling for cigs

Odds Ratio chi2(1) P>chi2 [95% Conf. Interval]

1.274028 3.40 0.0651 0.984318 1.

Test of homogeneity of ORs (approx): chi2(6) = 63. Pr>chi2 = 0.

Solution in SAS

SAS command is the same.

proc freq data=temp;

tables cigsmicasecoffee/cmh;

weight tally;

run ;

quit ;

You will find in the output

Cochran-Mantel-Haenszel Statistics (Based on Table Scores)

Statistic Alternative Hypothesis DF Value Prob ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ 1 Nonzero Correlation 1 3.4153 0. 2 Row Mean Scores Differ 1 3.4153 0. 3 General Association 1 3.4153 0.

…. Some output omitted ….

Breslow-Day Test for Homogeneity of the Odds Ratios ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ Chi-Square 63. DF 6 Pr > ChiSq <.

# NON diabetics who test - (462)

Specificity= 0.

Total # NON diabetics (510)

# Positive who have diabetes (59)

Predictive Value Positive= 0.

Total # Positives (107)

# Negatives who do NOT have diabetes (462)

Predictive Value Negative= 0.

Total # Negatives (473)

Solution using (http://statpages.org/ctab2x2.html):

B. Using the sensitivity and specificity values you got in part “A”, consider the following various

values of prevalence: .01, .05, .10, .20, .30, .40, .50, .60, .70, .80, .90, .95. Using these

prevalence values, construct a plot of the predictive value of a positive test on the vertical axis

versus prevalence on the horizontal axis. What you will have constructed is a plot of the

probability of diabetes given a positive test result as a function of prevalence.

The solution is an application of Bayes Theorem.

Let

• D = Event of diabetes

• + = Event of positive test

What we want to calculate is Probability (D | +)

What we have as available information is

• Probability (+ | D) = sensitivity =.

Probability (+ | not D) = 1 – specificity =.

• Probability (D) = prevalence = .01, .05, ….,.

Probability (not D) = 1 – prevalence = .99, .95, ….,.

Pr(D and +)

Pr( D | + ) =

Pr (+)

by definition of conditional probability.

Pr(+ | D) Pr(D)

Pr(+)

by definition of conditional probability the other way.

Pr(+ | D) Pr(D)

Pr(+ | D) Pr(D) + Pr(+ | not D) Pr(not D)

by theorem of total probabilities.

[Sensitivity] ( Prevalence )

[Sensitivity] ( Prevalence ) + [ 1 - specificity] ( 1 - prevalence)

[.843] ( Prevalence )

[.843] ( Prevalence ) + [ .094] ( 1 - prevalence)

This is easily plotted in excel.