Exercise 4.2

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
  1. Taking support for abortion as the outcome variable, produce fourfold displays showing the association with sex, stratified by status.
fourfold(Abortion)

b.Do the same for the association of support for abortion with status, stratified by sex.

Abortion1<-aperm(Abortion,c(3,1,2))
Abortion1
## , , Status = Lo
## 
##                 Sex
## Support_Abortion Female Male
##              Yes    171  152
##              No      79  148
## 
## , , Status = Hi
## 
##                 Sex
## Support_Abortion Female Male
##              Yes    138  167
##              No     112  133
fourfold(Abortion1)

  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=FALSE)
##  odds ratios for Sex and Status by Support_Abortion 
## 
##       Yes        No 
## 1.3614130 0.6338682
oddsratio(Abortion1,log=FALSE)
##  odds ratios for Support_Abortion and Sex by Status 
## 
##        Lo        Hi 
## 2.1075949 0.9812874

d.Write a brief summary of how support for abortion depends on sex and status.

Answer: When the social status if low, there is a significant association between gender and their attitude towards abortion. Females tend to support abortion while males tend to object abortion.

Exercise4.7

MovieReview = matrix(c(24,8,13,45,8,13,11,32,10,9,64,83,42,30,88,160),ncol=4,byrow=TRUE)
colnames(MovieReview) =c("Con","Mixed","Pro","Total")
rownames(MovieReview) = c("Con","Mixed","Pro","Total")
MovieReview<-as.table(MovieReview)
MovieReview
##       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.
Kappa(MovieReview)
##              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(MovieReview,main="Unweighted",weights=1)

agreementplot(MovieReview,main="Weighted")