## ----setup, include = FALSE--------------------------------------------------- knitr::opts_chunk$set(collapse = TRUE, comment = "#>") library(vcdinteractive) has_robustbase <- requireNamespace("robustbase", quietly = TRUE) ## ----------------------------------------------------------------------------- cells <- mosaic_cells(HairEyeColor) head(cells[, c("Hair", "Eye", "Sex", "observed", "expected", "leverage", residual_types)]) ## ----masking, eval = has_robustbase------------------------------------------- set.seed(1) tab <- as.table(matrix(rpois(25, 40), 5, dimnames = list(A = letters[1:5], B = LETTERS[1:5]))) tab[2, 3] <- 400 cells <- mosaic_cells(tab) # row b and column C, which contain the outlier sub <- cells[cells$A == "b" | cells$B == "C", c("A", "B", "observed", "expected", "expected_robust", "pearson", "standardized", "robust")] format(sub, digits = 2) ## ----------------------------------------------------------------------------- significant_cells(HairEyeColor, type = "standardized", adjust = "holm") ## ----widget, eval = has_robustbase-------------------------------------------- imosaic(HairEyeColor, residuals = "standardized", height = 560)