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.

library(vcdExtra)
## Warning: package 'vcdExtra' was built under R version 3.4.4
## Loading required package: vcd
## Warning: package 'vcd' was built under R version 3.4.4
## Loading required package: grid
## Loading required package: gnm
## Warning: package 'gnm' was built under R version 3.4.4
data("Abortion")
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"
  1. Taking support for abortion as the outcome variable, produce fourfold displays showing the association with sex, stratified by status.
fourfold(Abortion,c(3,1,2))

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

  1. For each of the problems above, use oddsratio () to calculate the numerical values of the odds ratio, as stratified in the question.
oddsratio(Abortion,log = F)
##  odds ratios for Sex and Status by Support_Abortion 
## 
##       Yes        No 
## 1.3614130 0.6338682
oddsratio(aperm(Abortion,log = F))
## log odds ratios for Support_Abortion and Status by Sex 
## 
##     Female       Male 
##  0.5634609 -0.2009764
  1. Write a brief summary of how support for abortion depends on sex and status.

Based on our results, by analyzing the data separetely using odds ration and fourfold displays, it can be concluded that generally males will support abortion when the status is high and women are more likely to support abortion when the status is low.

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”).

Ratings=matrix(c(24,8,13,45,8,13,11,32,10,9,64,83,42,30,88,160), ncol = 4, byrow = T)
colnames(Ratings) = c("Con", "Mixed", "Pro", "Total")
rownames(Ratings) = c("Con", "Mixed", "Pro", "Total")
Ratings
##       Con Mixed Pro Total
## Con    24     8  13    45
## Mixed   8    13  11    32
## Pro    10     9  64    83
## Total  42    30  88   160
  1. Assess the strength of agreement between the raters using Cohen’s ??, both unweighted and weighted.
library(vcd)
Kappa(Ratings)
##              value     ASE     z Pr(>|z|)
## Unweighted 0.09012 0.02882 3.127 0.001767
## Weighted   0.08737 0.03372 2.591 0.009573
  1. Use agreementplot () for a graphical display of agreement here.
agreementplot(Ratings,main="Unweighted Values")

agreementplot(Ratings,main="Weighted Values", weights = 1)