Skip to contents

Frequency of cancer in 39,876 women taking and not taking aspirin.

Usage

Aspirin

Format

A data frame with 39876 observations on the following

treatment

a factor with levels Aspirin and Placebo

cancer

a factor with levels no and yes

Source

Cook, N.R., I. Lee, J.M. Gaziano, D. Gordon, P.M. Ridker, J.E. Manson, C.H. Hennekens, and J.E. Buring. 2005. Low-dose aspirin in the primary prevention of cancer. Journal of the American Medical Association 294: 47-55.

Examples


demo(sec9.2)
#> 
#> 
#> 	demo(sec9.2)
#> 	---- ~~~~~~
#> 
#> > str(Aspirin)
#> 'data.frame':	39876 obs. of  2 variables:
#>  $ treatment: Factor w/ 2 levels "Aspirin","Placebo": 1 1 1 1 1 1 1 1 1 1 ...
#>  $ cancer   : Factor w/ 2 levels "no","yes": 2 2 2 2 2 2 2 2 2 2 ...
#> 
#> > # Plot 2 X 2 Contingency tables
#> > plot( ~ treatment + cancer, data = Aspirin)

#> 
#> > plot(table(Aspirin), main = "")

#> 
#> > # Calculate odds
#> > (Pr.asp <- 18496 / (18496 + 1438))
#> [1] 0.9278619
#> 
#> > (Odds.asp <- Pr.asp / (1 - Pr.asp))
#> [1] 12.86231
#> 
#> > (Pr.no.asp <- 18515 / (18515 + 1427))
#> [1] 0.9284425
#> 
#> > (Odds.no.asp <- Pr.no.asp / (1 - Pr.no.asp))
#> [1] 12.97477
#> 
#> > (Odds <- Odds.asp / Odds.no.asp)
#> [1] 0.9913321
#> 
#> > ln.Odds <- log(Odds)
#> 
#> > (SE.Odds <- sqrt(sum(1/table(Aspirin))))
#> [1] 0.03878475
#> 
#> > Z <- 1.96
#> 
#> > (CI.low <- ln.Odds - Z * SE.Odds)
#> [1] -0.08472376
#> 
#> > (CI.high <- ln.Odds + Z * SE.Odds)
#> [1] 0.06731248
#> 
#> > exp(CI.low)
#> [1] 0.918766
#> 
#> > exp(CI.high)
#> [1] 1.06963
#> 
#> > # Using oddsRatio() from the mosaic package
#> > # First reformat the data so that "No cancer" is in column 1
#> > # and "Aspirin" is in row 2.
#> > x <- matrix(c(18515, 18496, 1427, 1438), nrow = 2)
#> 
#> > x
#>       [,1] [,2]
#> [1,] 18515 1427
#> [2,] 18496 1438
#> 
#> > oddsRatio(x)
#> [1] 0.9913321