lab10 -...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
STAT5044: Lab4 Inyoung Kim
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Outline 1 How to analyze categorical data using R
Background image of page 2
Example Clinical Trial for Rosiglitazone (Avandia) for the treatment of diabetes Data Heart Attack No Heart Attack Total Avabdia 27 1429 1456 Control 41 2854 2895 Total 68 4283 4351 Question: Does Avandia cause more heart attacks than the Active control?
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Relative Risk Simulation Study Relative risk piR<-27/1456 piC<-41/2895 trueRR=piR/piC print(trueRR) nR<-1456 nC<-2895 g<-1000 xR<-rbinom(g,nR,piR) xC<-rbinom(g,nC,piC) pR<-xR/nR pC<-xC/nC par(mfcol=c(1,2)) hist(pR/pC, 20) hist(log(pR/pC),20)
Background image of page 4
Histogram for relative risk Histogram Histogram of pR/pC pR/pC Frequency 0.5 1.0 1.5 2.0 2.5 3.0 0 20 40 60 80 100 120 140 Histogram of log(pR/pC) log(pR/pC) -0.5 0.0 0.5 1.0 50 150
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Odds ratio simulation Odd ratio theta<-pR*(1-pC)/(pC*(1-pR)) par(mfcol=c(1,2)) hist(theta, 20) hist(log(theta),20)
Background image of page 6
Histogram of odd ratio Histogram Histogram of theta theta Frequency 0.5 1.0 1.5 2.0 2.5 3.0 0 20 40 60 80 100 120 140 Histogram of log(theta) log(theta) -0.5 0.0 0.5 1.0 50 150
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Pearson’s Chi Squared Test Independence test >avandia<-matrix(c(27,1429,41,2854),ncol=2,byrow=TRUE,
Background image of page 8
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 10
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: dimnames=list(c("Avandia","Control"),c("HeartAttack","NoHeartAttack"))) >chisq.test(avandia, correct=FALSE) Pearson’s Chi-squared test data: avandia X-squared = 1.209, df = 1, p-value = 0.2715 Example for McNemat Test Suppose two surveys on President’s job approval were conducted one month apart on n = 1600 Americans and the result is summarized in the following table Data 2nd survey Approve Disapprove 1st Approve 794 150 survey Disapprove 86 570 Question: Is there a significant difference in job approval rating? McNemar Test McNemar test > x<-matrix(c(794, 150, 86, 570), nrow=2, byrow=T) > mcnemar.test(x) McNemar’s Chi-squared test with continuity correction data: x McNemar’s chi-squared = 16.8178, df = 1, p-value = 4.115e-05 The result indicates that the job approval rating has significantly changed (dropped)....
View Full Document

This note was uploaded on 01/02/2012 for the course STAT 5044` taught by Professor Staff during the Fall '11 term at Virginia Tech.

Page1 / 10

lab10 -...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online