data(JobSatisfaction, package="vcd")
# view all pairwise mosaics
pairs(xtabs(Freq~management+supervisor+own, data=JobSatisfaction),
shade=TRUE, diag_panel=pairs_diagonal_mosaic)
modSat <- Kway(Freq ~ management+supervisor+own, data=JobSatisfaction,
family=poisson, prefix="JobSat")
names(modSat)
if (FALSE) {
mosaic(modSat) # uses menu, if interactive()
}
mosaic(modSat, "JobSat.1") # model label
mosaic(modSat, 2) # model index
# supply a formula to determine the order of variables in the mosaic
mosaic(modSat, 2, formula=~own+supervisor+management)
mosaic(modSat, ask=FALSE) # uses viewports
# use a different panel function, label the observed valued in the cells
mosaic(modSat, 1, main=TRUE, panel=sieve, gp=shading_Friendly, labeling=labeling_values)
data(Mental)
indep <- glm(Freq ~ mental+ses,
family = poisson, data = Mental)
Cscore <- as.numeric(Mental$ses)
Rscore <- as.numeric(Mental$mental)
coleff <- glm(Freq ~ mental + ses + Rscore:ses,
family = poisson, data = Mental)
roweff <- glm(Freq ~ mental + ses + mental:Cscore,
family = poisson, data = Mental)
linlin <- glm(Freq ~ mental + ses + Rscore:Cscore,
family = poisson, data = Mental)
# assign names for the plot labels
modMental <- glmlist(Indep=indep, ColEff=coleff, RowEff=roweff, `Lin x Lin`=linlin)
mosaic(modMental, ask=FALSE, margins=c(3,1,1,2), labeling_args=list(abbreviate_labs=5))
Run the code above in your browser using DataLab