library(HistData)
library(vcdExtra)
## Loading required package: vcd
## Loading required package: grid
## Loading required package: gnm
library(plotly)
## Loading required package: ggplot2
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:vcdExtra':
##
## summarise
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
data("Abortion", package="vcdExtra")
str(Abortion)
## table [1:2, 1:2, 1:2] 171 152 138 167 79 148 112 133
## - attr(*, "dimnames")=List of 3
## ..$ Sex : chr [1:2] "Female" "Male"
## ..$ Status : chr [1:2] "Lo" "Hi"
## ..$ Support_Abortion: chr [1:2] "Yes" "No"
showing the association with sex, stratified by status.
fourfold(Abortion,c(3,1,2))
fourfold(Abortion, 3:1)
oddsratio(Abortion, log = FALSE)
## odds ratios for Sex and Status by Support_Abortion
##
## Yes No
## 1.3614130 0.6338682
oddsratio(Abortion, stratum="Sex", log=FALSE)
## odds ratios for Sex and Status by Support_Abortion
##
## Female Male
## 1.3614130 0.6338682
oddsratio(Abortion, stratum="Status", log=FALSE)
## odds ratios for Sex and Status by Support_Abortion
##
## Lo Hi
## 1.3614130 0.6338682
When compared to Hi status females, higher Lo status females support abortion. Hi Status Male is more likely to support abortion than Lo status Male.
siskel = matrix(c(24,8,13,45,8,13,11,32,10,9,64,83,42,30,88,160), ncol=4, byrow=TRUE)
colnames(siskel) = c("Con","Mixed","Pro","Total")
rownames(siskel) = c("Con","Mixed","Pro","Total")
siskel = as.table(siskel)
siskel
## Con Mixed Pro Total
## Con 24 8 13 45
## Mixed 8 13 11 32
## Pro 10 9 64 83
## Total 42 30 88 160
Kappa(siskel)
## value ASE z Pr(>|z|)
## Unweighted 0.09012 0.02882 3.127 0.001767
## Weighted 0.08737 0.03372 2.591 0.009573
agreementplot(siskel,main="Unweighted",weights=1)
agreementplot(siskel,main="Weighted")