naBlocks {shapeNA} | R Documentation |
Reorder Data with Missing Values
Description
Reorder a data set with NA
entries to form blocks of missing values. The
resulting data will have increasing missingness along the rows and along the
columns. The rows are ordered such that the first block consists of complete
observations, and the following blocks are ordered from most frequent
missingness pattern to least frequent missingness pattern.
Usage
naBlocks(x, cleanup = TRUE, plot = FALSE)
Arguments
x |
A matrix with missing values. |
cleanup |
A logical flag. If |
plot |
A logical flag. If |
Details
In case of ties, that is if two patterns occur with the same frequency, the block whose pattern occurs first will be ordered in front of the other block.
This method may fail if the missingness is too strong or if the number of observations is too low (the number of observations has to exceed the number of variables), as it has been designed as a preprocessing step for shape estimations.
Value
A list of class naBlocks
with components:
x |
The reordered data matrix. |
permutation |
The permutation of the columns that was applied to reorder the columns according to the number of |
rowPermutation |
The permutation of the rows that generates the blocks. |
N |
A vector of all row indices. Each row number points to the beginning of a new missingness pattern. |
D |
A vector specifying the missingness pattern for each block. |
P |
A vector specifying the number of observed variables per block. |
kn |
A vector specifying the percentage of observed responses per variable. |