0.0.1 Abortion data

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

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"

0.0.1.1 (a)Taking support for abortion as the outcome variable, produce fourfold displays showing the association with sex, stratified by status. In addition, use oddsratio () to calculate the numerical

values.

# plot associate stratified by status
fourfold(Abortion)

# Oddsratio
oddsratio1 <- oddsratio(Abortion, stratum="Status", log=FALSE)
oddsratio1
##  odds ratios for Sex and Status by Support_Abortion 
## 
##        Lo        Hi 
## 1.3614130 0.6338682
summary(oddsratio(Abortion, stratum="Status"))
## 
## z test of coefficients:
## 
##    Estimate Std. Error z value Pr(>|z|)  
## Lo  0.30852    0.16019  1.9260  0.05411 .
## Hi -0.45591    0.18937 -2.4075  0.01606 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(oddsratio1)

0.0.1.2 (b) Do the same for the association of support for abortion with status, stratified by sex. In addition, use oddsratio () to calculate the numerical values

#plot stratified by sex
fourfold(aperm(Abortion))

#plot odds ratio
oddsratio2 <- oddsratio(Abortion, stratum="Sex", log=FALSE)
oddsratio2
##  odds ratios for Sex and Status by Support_Abortion 
## 
##    Female      Male 
## 1.3614130 0.6338682
plot(oddsratio2)

####(c) write a brief summary of how support for abortion depends on sex and status.

confint(oddsratio(Abortion, log=FALSE))
##         2.5 %    97.5 %
## Yes 0.9945685 1.8635675
## No  0.4373246 0.9187431

Both the odds ratio stratified by Sex and Status are not equal to 1. therefore, we can say the two groups (Sex/ Stratum) support abortion rate are not the same.

0.0.2 Agresti and Winner moving data

a <-  cbind(x1= c(24, 8, 10 ,42), x2=c(8,13,9, 30), 
            x3=c(13,11, 64, 88), x4=c(45,32, 83,160))
colnames(a) <- c("con", "mixed", "pro", "total")
rownames(a) <- c("con", "mixed", "pro", "total")
movie <- as.table(a)
movie
##       con mixed pro total
## con    24     8  13    45
## mixed   8    13  11    32
## pro    10     9  64    83
## total  42    30  88   160

0.0.2.1 (a) Assess the strength of agreement between the raters using Cohen’s ??, both unweighted and weighted.

Kappa(movie)
##              value     ASE     z Pr(>|z|)
## Unweighted 0.09012 0.02882 3.127 0.001767
## Weighted   0.08737 0.03372 2.591 0.009573

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

agreementplot(movie)