analyze_missing_pattern: Describe the missing-data pattern of an omics matrix

View source: R/missing_data_diagnostics.R

analyze_missing_patternR Documentation

Describe the missing-data pattern of an omics matrix

Description

Summarises where missingness sits in an omics layer before a LUCID model is fitted, so that the choice between listwise and sporadic handling can be made from the data rather than assumed. Reports missingness by feature and by subject, flags the features and subjects that are more than half missing, and counts the distinct missingness patterns present.

The number of distinct patterns is the diagnostic that matters most for cost: the observed-data likelihood is evaluated once per pattern, so a matrix with few patterns (largely listwise missingness) is far cheaper to fit than one of the same sparsity spread over many patterns.

Usage

analyze_missing_pattern(Z)

Arguments

Z

An N by M omics matrix, or an object coercible to one by as.matrix. Missing values are NA.

Value

A list with components:

col_missingness

Proportion missing for each of the M features.

row_missingness

Proportion missing for each of the N subjects.

high_miss_cols

Integer indices of features more than half missing.

high_miss_rows

Integer indices of subjects more than half missing.

n_complete

Number of subjects with no missing feature.

n_patterns

Number of distinct missingness patterns, counting the complete pattern if any subject is complete.

total_missing

Proportion of missing cells over the whole matrix.

See Also

check_na, which classifies subjects into the complete / sporadic / listwise categories the EM algorithm branches on.

Examples

Z <- matrix(rnorm(200), nrow = 20)
Z[1:3, 1] <- NA
Z[5, ] <- NA
analyze_missing_pattern(Z)[c("n_complete", "n_patterns", "total_missing")]

LUCIDus documentation built on Sept. 3, 2026, 1:06 a.m.