Exercise 4.2 The data set Abortion in vcdExtra gives a 2 × 2 × 2 table of opinions regarding abortion in relation to sex and status of the respondent. This table has the following structure:
library(vcdExtra)
## Warning: package 'vcdExtra' was built under R version 3.4.2
## Loading required package: vcd
## Warning: package 'vcd' was built under R version 3.4.3
## Loading required package: grid
## Loading required package: gnm
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"
Abortion
## , , Support_Abortion = Yes
##
## Status
## Sex Lo Hi
## Female 171 138
## Male 152 167
##
## , , Support_Abortion = No
##
## Status
## Sex Lo Hi
## Female 79 112
## Male 148 133
(a) Taking support for abortion as the outcome variable, produce fourfold displays showing the association with sex, stratified by status.
fourfold(aperm(Abortion,c(3,1,2)))

(b) Do the same for the association of support for abortion with status, stratified by sex.
fourfold(aperm(Abortion,c(3,2,1)))

(c) For each of the problems above, use oddsratio () to calculate the numerical values of the odds ratio, as stratified in the question.
#For status (a)
oddsratio(aperm(Abortion,c(3,1,2)), log=FALSE)
## odds ratios for Support_Abortion and Sex by Status
##
## Lo Hi
## 2.1075949 0.9812874
#For sex (b)
oddsratio(aperm(Abortion,c(3,2,1)), log=FALSE)
## odds ratios for Support_Abortion and Status by Sex
##
## Female Male
## 1.7567419 0.8179317
(d) Write a brief summary of how support for abortion depends on sex and status.
- Under the low status, more female support abortion. Under high status, more male support abortion.
- For females, more low status support abortion. For males, more high status support abortion.
- To summary, low status females are more likely to support abortion.
Exercise 4.7 Agresti and Winner (1997) gave the data in below on the ratings of 160 movies by the reviewers Gene Siskel and Roger Ebert for the period from April 1995 through September 1996. The rating categories were Con (“thumbs down”), Mixed, and Pro (“thumbs up”).
#Create table
GS_RE_Review <- matrix(c(24,8,13,8,13,11,10,9,64), nrow=3, ncol = 3, byrow = TRUE)
rownames(GS_RE_Review) <- c("Con", "Mixed", "Pro")
colnames(GS_RE_Review) <- c("Con", "Mixed", "Pro")
GS_RE_Review
## Con Mixed Pro
## Con 24 8 13
## Mixed 8 13 11
## Pro 10 9 64
(a) Assess the strength of agreement between the raters using Cohen’s κ, both unweighted and weighted.
Kappa(GS_RE_Review)
## value ASE z Pr(>|z|)
## Unweighted 0.3888 0.05979 6.503 7.870e-11
## Weighted 0.4269 0.06350 6.723 1.781e-11
(b) Use agreementplot () for a graphical display of agreement here.
agreementplot(GS_RE_Review, main = "Unweighted", weights = 1)

agreementplot(GS_RE_Review, main="Weighted")
