0

I have the following code:

#Loading libraries
library(grid)
library(vcd)

#creating table
ds = array(c(14,4,7, 10,15,9, 3,11,5), dim=c(3,3),
dimnames=list('Radio Format Preference'=c('Music','News-talk','Sports'), 'Age'=c('Young Adult','Middle Age','Older Adult')))

ds = as.table(ds)

#Calculate row and column proportions
ft = ftable(ds)
pro_row = prop.table(ft,1)
pro_col = prop.table(ft,2)

#plot mosaic
mosaic(ds,legend=TRUE,shade=TRUE)

My problem is that my mosaic plot stays greyed out, even though I set shade=TRUE.

enter image description here

What am I missing here?

JoeBe
  • 1,224
  • 3
  • 13
  • 28
  • 2
    The Pearson residuals appear to be all lower than 2 in absolute value, which is the default cut off. More details when I'm at a proper computer... – Achim Zeileis Mar 16 '19 at 14:41
  • Ah... I think I got it now! It means that no observations are different from expectation, correct? – JoeBe Mar 16 '19 at 14:49
  • A comment from another thread about the coloring: _The shadings are made based on the Pearson residuals of an independence model - by default complete independence of all factors but can also be changed to other independence models. The cutoffs of 2 and 4 are based on certain heuristics and are meant to bring out patterns in the Pearson residuals._ [source](https://stats.stackexchange.com/questions/153446/r-how-to-interpret-mosaic-and-association-plots) EDIT: Just saw that answer was made by you @AchimZeileis – JoeBe Mar 16 '19 at 14:57
  • The answer to my question is basic statistics explained in [another thread's answer](https://stackoverflow.com/questions/29837257/how-to-change-color-palette-of-mosaic-plot?answertab=votes#tab-top). – JoeBe Mar 16 '19 at 15:10

0 Answers0