hw7.sol - Page 1 of 2 Stat209/Ed260 D Rogosa 2/28/09...

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

View Full Document Right Arrow Icon
Stat209/Ed260 D Rogosa 2/28/09 Solutions Assignment 7. Compliance and experimental protocols; intent to treat Problem 1 > library(vcd) # visualizing categorical data is a package that gives many odds ratio capabilities. In base R fisher.test gives odds ratio CI Loading required package: MASS Loading required package: grid Loading required package: colorspace input 2x2 table > ittdat = matrix(c(round(1103*.8), 1103 - round(1103*.8), + round(2789*.791), 2789 - round(2789*.791)), nr = 2, byrow = T) > # row 1 drug clofibrate row 2 placebo, col2 mortality > ittdat [,1] [,2] [1,] 882 221 [2,] 2206 583 get row proportions (conditional probabilities) > prop.table(ittdat,1) #props by row [,1] [,2] [1,] 0.7996374 0.2003626 [2,] 0.7909645 0.2090355 > # row 1 drug clofibrate row 2 placebo, col2 mortality > # relative risk close to 1.0 odds ratio > oritt = oddsratio(ittdat, log = F) > summary(oritt) Odds Ratio [1,] 1.0547 > confint(oritt) # confidence interval 95% for oddds ratio lwr upr [1,] 0.8869352 1.254258
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

hw7.sol - Page 1 of 2 Stat209/Ed260 D Rogosa 2/28/09...

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

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