handle_na_values: Handle NA values in a numeric matrix

handle_na_valuesR Documentation

Handle NA values in a numeric matrix

Description

Handle NA values in a numeric matrix

Usage

handle_na_values(
  x,
  idesign,
  handle_na = c("full1", "full", "partial", "none", "all"),
  na_value = 0,
  na_weight = 0,
  return_weights = FALSE,
  verbose = FALSE,
  ...
)

Arguments

x

numeric matrix

idesign

numeric matrix with rownames(idesign) equal to colnames(x), containing 0 or 1 to fill the design matrix.

handle_na

character string to determine the method used to handle NA values in x.

na_value

numeric or NA used to handle NA values.

na_weight

numeric weight between 0 and 1 used for NA values in the weight matrix, used when return_weights=TRUE.

return_weights

logical indicating whether to include a weight matrix as an attribute with name "weights".

verbose

logical indicating whether to print verbose output.

...

additional arguments are ignored.

Details

This function provides reasonable alternatives intended to manage the presence of missing data encoded as NA values in a numeric matrix.

The alternatives are defined by argument handle_na:

  • "full": Retain NA values, except when an entire group is NA it is replaced with na_value. This option is intended for sparse data where non-NA values are accepted as real measurements for each group, and where a group with all NA values should be retained for statistical contrasts by assigning na_value. This method essentially keeps the data as-is, except when groups are otherwise entirely NA the value na_value is used in order to retain any relevant contrasts that involve this group.

  • "full1": Similar to "full", retain NA values, except when an entire group is NA, then replace only one entry with na_value. This option is intended to keep data as-is, except to retain groups that are otherwise entirely NA. In these groups, only one na_value is used in order to prevent the group from contributing toward group variability or dispersion calculations.

  • "partial": Replace NA values with na_value, except when an entire group is NA the entire group is kept at NA.

  • "all": Replace all NA values with na_value.

  • "none": Perform no replacement of NA values.

Value

numeric matrix with equal dimensions as input x, where NA values have been handled as defined by handle_na.

See Also

Other jamses stats: ebayes2dfs(), matrix_normalize(), run_limma_replicate(), se_contrast_stats(), se_normalize(), voom_jam()


jmw86069/jamses documentation built on May 31, 2024, 1:36 p.m.