Excercise 4.2

The Abortion dataset provides a 2x2x2 table with opinions regarding abortion in relation to sex and status.

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"

A) Taking support for abortion as outcome variable, produce furfold displays showing the association with sex, stratified by status.?

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
fourfold(Abortion)

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

fourfold(aperm(Abortion))

c) For each of the problems above, use oddsratio () to calculate the numerical values of the odds ratio as stratified in the question.

oddsratio(x = Abortion,log = F)
##  odds ratios for Sex and Status by Support_Abortion 
## 
##       Yes        No 
## 1.3614130 0.6338682
oddsratio(x = aperm(Abortion),log= F)
##  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.

Female support differs significantly per status, support is higher when status is low. On the other hand, status doe snot have a significant influence on male support. Overall, the oddsratio indicates that a great majority of opinions are.


Excercise 4.7

Table below displays ratings of 160 movies from April 1995 to September 1996. Con (thums down), mixed, 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

A) Assess the strength of agreement between the raters using Cohen’s k, both unweighted and weighted.

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

B) Use agreementplot () for a graphical display of agreement here.

library(vcd)
agreementplot(x = Ratings, weights = 1, main="Weighted value of Agreement")