help for misspatternIan White

Title

misspattern -- Graph missing data pattern

Description

misspattern creates a rectangular display of a data set, with the variables on the vertical axis and observations on the horizontal axis, filled in with two different colours to show observed and missing data. It can be used to assess the extent and pattern of missing data in a dataset.

Syntax

misspattern
[varlist]
[if] [in]
[, options]

Main
novarsort Keeps variables in their order in the data set. Otherwise the variables are sorted from least missing at the top to most missing at the bottom.

noidsort Keeps observations in their original order in the data set. Otherwise the observations are sorted from least missing at the left to most missing at the right.

reverse reverses the order of the variables

misscolor(string) specifies the shading used for missing values: default is black.

obscolor(string) specifies the shading used for observed values: default is grey.

clear clears the current data and loads the summary data into memory: this could be useful if you want to fine-tune the graph

indivsname(string) specifies how the graph refers to the records: default is "individuals".

label labels the vertical axis using variable labels instead of variable names.

varlabel(cat_axis_label_options) allows options for the appearance of the variable names or labels. For example, varlabel(labsize(small) labcol(red)).

graph_options are any other options allowed by graph hbar.

Remarks

A monotone pattern is characterised by a "staircase" pattern with the missing values below and to the right of the observed values.

misspattern is implemented using graph hbar with a set of bars of alternating colour.
The number of such bars used is output; it is usually fewer than the number of distinct patterns.
The code uses one option to define the colour of each bar: because Stata limits the number of options t0 70, the code fails with the message "too many options" if there are more than about 60 bars.
If this happens, try reducing the number of variables. (In the future I may find a way to eliminate a few observations so that the code works on the remainder.)

Examples

. use UK500, clear

Summary of the whole data set:

. misspattern

More detailed view, changing several options:

. misspattern cprs* sat* if centre==3, misscol(red) obscol(blue) ytitle(,size(large)) varlabel(labsize(large)) legend(size(large))

See also

mtable -- table showing missing values
mscatter -- scatterplot showing missing values