This function draws a cellmap, possibly of a subset of rows and columns of the data, and possibly combining cells into blocks. A cellmap shows which cells are missing and which ones are outlying, marking them in red for unusually large cell values and in blue for unusually low cell values. When cells are combined into blocks, the final color is the average of the colors in the individual cells.
cellMap(R, indcells = NULL, indrows = NULL, outrows = NULL,
showcellvalues = NULL, D = NULL, rowlabels = NULL,
columnlabels = NULL, mTitle = "cell map",
rowtitle = "cases", columntitle = "variables",
showrows = NULL, showcolumns = NULL,
nrowsinblock = NULL, ncolumnsinblock = NULL,
manualrowblocksizes = NULL,
manualcolumnblocksizes = NULL,
rowblocklabels = NULL, columnblocklabels = NULL,
sizemain = 1.5, sizetitles = 1.2, sizerowlabels = 1,
sizecolumnlabels = 1, sizecellvalues = 1,
adjustrowlabels = 1, adjustcolumnlabels = 1,
columnangle = 90, colContrast = 1,
outlyingGrad = TRUE,
darkestColor = sqrt(qchisq(0.999, 1)),
drawCircles = FALSE, showVals = NULL, autolabel = TRUE)
Matrix of standardized residuals of the cells (required input argument). After running DDC
, DDCpredict
, MacroPCA
or MacroPCApredict
this is typically their value $stdResid
.
Indices of flagged cells. Defaults to NULL
, which flags the cells for which
\(|\code{R}| > \sqrt(qchisq(0.99,1))\).
Indices of outlying rows (if available). If not NULL
, the small circle to the right of the row is filled black if the row is in this list, and white otherwise. This gets overruled if outrows
is not NULL
.
Outlyingness of each row (if available). If not NULL
, represents the outlyingness of each row by a shade of gray in the small circle to the right of the row. This color is white for outrows
below \(1\), and becomes fully black for outrows
over \(3\).
Takes the values "D"
, "R"
or NULL
(the default). If "R"
the numerical values of the residuals in R
are shown in the cellmap. If "D"
, the entries of the data matrix D
are shown, provided the matrix D
is being specified. If NULL
, no entries are shown.
A matrix of data values, of the same dimensions as R
. Default is NULL
. D
is only required when the data values are to be shown in the cellmap, by the option showcellvalues = "D"
. After running DDC
or MacroPCA
, D
is typically their value $remX
. After running DDCpredict
or MacroPCApredict
it is their argument $newX
.
Labels of the rows of the matrix R
. If NULL
, these labels are taken as rownames(R
), and failing that they are 1:nrow(R)
.
Labels of the columns of the matrix R
. If NULL
, these labels are taken as colnames(R
), and failing that they are 1:ncol(R)
.
Main title of the cellMap. Defaults to "cell map".
Title for the rows. Defaults to "cases".
Title for the columns. Defaults to "variables".
Indices of the rows to be shown. Defaults to NULL
which means all rows are shown.
Indices of the columns to be shown. Defaults to NULL
which means all columns are shown.
How many rows are combined in a block. Defaults to NULL
, which asks not to block rows. The argument nrowsinblock
is overruled by the argument manualrowblocksizes
when the latter is specified.
Defaults to NULL
, which asks not to block columns. The argument ncolumnsinblock
is overruled by the argument manualcolumnblocksizes
when the latter is specified.
This allows the user to specify their own row blocks, unlike the argument nrowsinblock which makes all row blocks the same length. The argument takes the form c(a,b,...)
where a
is the length of the first block, b
is the length of the second, and so on. The numbers a,b,...
must be strictly positive integers, adding up to at most nrow(R)
. They cannot all be 1, which would mean no blocking of rows. Defaults to NULL
.
Analogous to manualrowblocksizes but for columns. It is allowed for one of them to be NULL
while the other is not.
This allows the user to specify labels for the row blocks, whether obtained from nrowsinblock
or from manualrowblocksizes
. Defaults to NULL
, and then labels will be created automatically. Will throw an error if the number of row labels does not match the number of blocks.
Analogous to rowblocklabels
but for columns. It is allowed for one of them to be NULL
while the other is not.
Size of main title. Defaults to \(1.5\).
Size of row title and column title. Defaults to \(1.2\).
Size of row labels. Defaults to \(1\).
Size of column labels. Defaults to \(1\).
Size of values in the cells, when showcellvalues = TRUE. Defaults to \(1\).
Adjust row labels: 0=left, 0.5=centered, 1=right. Defaults to \(1\).
Adjust column labels: 0=left, 0.5=centered, 1=right. Defaults to \(1\).
Angle of the column labels. Defaults to \(90\) so the column labels are vertical.
Parameter regulating the contrast of colors, should be in \([1,5]\). Defaults to \(1\).
If TRUE
, the color is gradually adjusted in function of the outlyingness. Defaults to TRUE
.
Standardized residuals whose absolute value is bigger than this will get the darkest color.
Whether or not to draw circles indicating outlyingness of rows. When both indrows
and outrows
are NULL, no circles are drawn.
old name of argument showcellvalues
. Only for backward compatibility.
obsoleted by the current machanism for creating blocks of cells. Is only in the list for backward compatibility.
Rousseeuw P.J., Van den Bossche W.
Rousseeuw, P.J., Van den Bossche W. (2018). Detecting Deviating Data Cells. Technometrics, 60(2), 135-145. (link to open access pdf)
DDC
# For examples of the cellmap, we refer to the vignette:
if (FALSE) {
vignette("DDC_examples")
}
Run the code above in your browser using DataLab