Learn R Programming

cellWise (version 2.5.3)

cellMap: Draw a cellmap

Description

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.

Usage

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)

Arguments

R

Matrix of standardized residuals of the cells (required input argument). After running DDC, DDCpredict, MacroPCA or MacroPCApredict this is typically their value $stdResid.

indcells

Indices of flagged cells. Defaults to NULL, which flags the cells for which \(|\code{R}| > \sqrt(qchisq(0.99,1))\).

indrows

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.

outrows

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\).

showcellvalues

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.

D

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.

rowlabels

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).

columnlabels

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).

mTitle

Main title of the cellMap. Defaults to "cell map".

rowtitle

Title for the rows. Defaults to "cases".

columntitle

Title for the columns. Defaults to "variables".

showrows

Indices of the rows to be shown. Defaults to NULL which means all rows are shown.

showcolumns

Indices of the columns to be shown. Defaults to NULL which means all columns are shown.

nrowsinblock

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.

ncolumnsinblock

Defaults to NULL, which asks not to block columns. The argument ncolumnsinblock is overruled by the argument manualcolumnblocksizes when the latter is specified.

manualrowblocksizes

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.

manualcolumnblocksizes

Analogous to manualrowblocksizes but for columns. It is allowed for one of them to be NULL while the other is not.

rowblocklabels

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.

columnblocklabels

Analogous to rowblocklabels but for columns. It is allowed for one of them to be NULL while the other is not.

sizemain

Size of main title. Defaults to \(1.5\).

sizetitles

Size of row title and column title. Defaults to \(1.2\).

sizerowlabels

Size of row labels. Defaults to \(1\).

sizecolumnlabels

Size of column labels. Defaults to \(1\).

sizecellvalues

Size of values in the cells, when showcellvalues = TRUE. Defaults to \(1\).

adjustrowlabels

Adjust row labels: 0=left, 0.5=centered, 1=right. Defaults to \(1\).

adjustcolumnlabels

Adjust column labels: 0=left, 0.5=centered, 1=right. Defaults to \(1\).

columnangle

Angle of the column labels. Defaults to \(90\) so the column labels are vertical.

colContrast

Parameter regulating the contrast of colors, should be in \([1,5]\). Defaults to \(1\).

outlyingGrad

If TRUE, the color is gradually adjusted in function of the outlyingness. Defaults to TRUE.

darkestColor

Standardized residuals whose absolute value is bigger than this will get the darkest color.

drawCircles

Whether or not to draw circles indicating outlyingness of rows. When both indrows and outrows are NULL, no circles are drawn.

showVals

old name of argument showcellvalues. Only for backward compatibility.

autolabel

obsoleted by the current machanism for creating blocks of cells. Is only in the list for backward compatibility.

Author

Rousseeuw P.J., Van den Bossche W.

References

Rousseeuw, P.J., Van den Bossche W. (2018). Detecting Deviating Data Cells. Technometrics, 60(2), 135-145. (link to open access pdf)

See Also

DDC

Examples

Run this code
# For examples of the cellmap, we refer to the vignette:
if (FALSE) {
vignette("DDC_examples")
}

Run the code above in your browser using DataLab