【发布时间】:2015-04-24 01:39:37
【问题描述】:
我有以下数据和代码:
> mat <- matrix(c(120,230,84,70,130,83,13,26,18),3)
> dimnames(mat) <- list(c("good","fair","poor"),c("a","b","c"))
> mat
> mat
a b c
good 120 70 13
fair 230 130 26
poor 84 83 18
>
> chisq.test(mat)
Pearson's Chi-squared test
data: mat
X-squared = 11.411, df = 4, p-value = 0.02231
> library(vcd)
> mosaic(mat, shade=T)
卡方检验显示出显着差异,但由于残差很小,因此看不到颜色。残差越高,颜色越明显:
?mosaic 显示此信息:
highlighting_fill: color vector or palette function used for a highlighted variable, if any.
如何更改上述绘图的填充颜色?
【问题讨论】: