Uploading Data

library(vcd)
## Loading required package: grid
library(vcdExtra)
## Loading required package: gnm
library(MASS)
data(DaytonSurvey, package = "vcdExtra")
Dayton.ACM <- aggregate(Freq ~ cigarette + alcohol + marijuana, data = DaytonSurvey, FUN=sum)
Dayton.ACM
##   cigarette alcohol marijuana Freq
## 1       Yes     Yes       Yes  911
## 2        No     Yes       Yes   44
## 3       Yes      No       Yes    3
## 4        No      No       Yes    2
## 5       Yes     Yes        No  538
## 6        No     Yes        No  456
## 7       Yes      No        No   43
## 8        No      No        No  279
  1. Using LogLm fitting Model
Regression <- loglm(Freq ~ cigarette + alcohol + marijuana, data= Dayton.ACM)
Regression
## Call:
## loglm(formula = Freq ~ cigarette + alcohol + marijuana, data = Dayton.ACM)
## 
## Statistics:
##                       X^2 df P(> X^2)
## Likelihood Ratio 1286.020  4        0
## Pearson          1411.386  4        0
  1. Mosaic Display for Association
mosaic(Regression, shade = TRUE, labeling = labeling_residuals)

It can be told that there is a possitive association between alcohol and usage of cigarette

fourfold(xtabs(Freq ~ alcohol + cigarette + marijuana, data = DaytonSurvey), main = 'AC stratified by M')

fourfold(xtabs(Freq ~ alcohol + marijuana + cigarette, data = DaytonSurvey), main = 'AM stratified by C')

fourfold(xtabs(Freq ~ marijuana + cigarette + alcohol, data = DaytonSurvey), main = 'CM stratified by A')

Summary: 1. If someone use marijuana, more likely they also using alcohol and cigarette. If someone does not use marijuana, more likely not use alcohol or cigarette. 2. If someone use cigarette, more likely they also using alcohol and marijuana. If someone does not use cigarette, more likely not use alcohol or marijuana. 2. If someone use alcohol, more likely they also using cigarette and marijuana. If someone does not use alcohol, more likely not use cigarette or marijuana.