naBlocks: Reorder Data with Missing Values

Description Usage Arguments Details Value

View source: R/utils.R

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

1
naBlocks(x, cleanup = TRUE, plot = FALSE)

Arguments

x

A matrix with missing values.

cleanup

A logical flag. If TRUE, observations with less than 2 responses are discarded.

plot

A logical flag. If TRUE, a plot of the missingness pattern is produced.

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

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.


shapeNA documentation built on March 15, 2021, 5:06 p.m.

Related to naBlocks in shapeNA...