imputationHotDeck: Hot Deck Imputation

View source: R/imputationHotDeck.R

imputationHotDeckR Documentation

Hot Deck Imputation

Description

Replace missing values with a randomly selected, non-NA value from that element's column or row.

Usage

imputationHotDeck(
  x,
  by.row = FALSE,
  row.range = 1:nrow(x),
  col.range = 1:ncol(x)
)

Arguments

x

A matrix-like R object with two dimensions to perform imputation on.

by.row

A logical value indicating whether to calculate the mean by the values within an element's row or not. Default = TRUE

row.range

A numeric vector containing the row numbers to be included in the hot deck imputation.

col.range

A numeric vector containing the column numbers to be included in the hot deck imputation.

Value

Returns the passed data with missing values imputed with a random value from that element's column or row.

Examples

# Default by column
imputed_mean <- imputationMean(data)

# By row, excluding the first column.
imputed_mean_byrow <- imputationMean(data_byrow,
col.range = 2:ncol(data_byrow))

Echinoidea/hooks-imputation documentation built on May 8, 2022, 4:39 p.m.