Gender<-c("Female","Female","Male","Male")
Smoke<-c("No","Yes","No","Yes")
count<-c(314,44,334,33)
tab<-matrix(c(314,44,334,33),nrow = 2,byrow = T)
colnames(tab)<-c("No","Yes")
rownames(tab)<-c("Female","Male")
tab
## No Yes
## Female 314 44
## Male 334 33
visualize
barplot(tab,beside=T,legend=T)
ANALYSIS
library(epiR)
## Loading required package: survival
## Package epiR 2.0.63 is loaded
## Type help(epi.about) for summary information
## Type browseVignettes(package = 'epiR') to learn how to use epiR for applied epidemiological analyses
##
epi.2by2(tab,method="cohort.count",conf.level=0.95)
## Outcome + Outcome - Total Inc risk *
## Exposed + 314 44 358 87.71 (83.85 to 90.93)
## Exposed - 334 33 367 91.01 (87.60 to 93.73)
## Total 648 77 725 89.38 (86.91 to 91.53)
##
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio 0.96 (0.92, 1.01)
## Inc odds ratio 0.71 (0.44, 1.14)
## Attrib risk in the exposed * -3.30 (-7.79, 1.19)
## Attrib fraction in the exposed (%) -3.76 (-9.12, 1.34)
## Attrib risk in the population * -1.63 (-5.32, 2.06)
## Attrib fraction in the population (%) -1.82 (-4.34, 0.64)
## -------------------------------------------------------------------
## Uncorrected chi2 test that OR = 1: chi2(1) = 2.077 Pr>chi2 = 0.150
## Fisher exact test that OR = 1: Pr>chi2 = 0.185
## Wald confidence limits
## CI: confidence interval
## * Outcomes per 100 population units
the odds of a female not smoking are 0.71 times the odds of a male not smoking .the inverse of 0.71=1/0.71=1.4 interpreted as the odds of a male not smoking are 1.4 times the odds of a female not smoking.
tab1
tab1<-matrix(c(44,314,33,334),nrow = 2,byrow = T)
colnames(tab1)<-c("Yes","No")
rownames(tab1)<-c("Female","Male")
tab1
## Yes No
## Female 44 314
## Male 33 334
COMBINE tab1 and tab
tab3<-cbind(tab[,2],tab1[,2])
tab3