Skip to contents

Numeric columns only in this port: the Python module also mode-fills object columns, which has no faithful R equivalent without deciding a factor/character convention, so that arm is NOT ported (see the package NOTE in the parity tests).

Usage

morie_geron_imputation_median(X, missing_values = NULL, add_indicator = TRUE)

Arguments

X

Numeric vector or matrix, NA marking missing.

missing_values

Optional extra sentinel value.

add_indicator

Return the missingness mask.

Value

List with X_imputed, statistics, indicator, n_missing, missing_fraction, strategy, estimate, n.

Examples

V <- c(1, 2, 3, 4, 5, 6, 7, 8)
morie_geron_imputation_median(V)
#> $X_imputed
#>      [,1]
#> [1,]    1
#> [2,]    2
#> [3,]    3
#> [4,]    4
#> [5,]    5
#> [6,]    6
#> [7,]    7
#> [8,]    8
#> 
#> $statistics
#> [1] 4.5
#> 
#> $indicator
#>       [,1]
#> [1,] FALSE
#> [2,] FALSE
#> [3,] FALSE
#> [4,] FALSE
#> [5,] FALSE
#> [6,] FALSE
#> [7,] FALSE
#> [8,] FALSE
#> 
#> $n_missing
#> [1] 0
#> 
#> $missing_fraction
#> [1] 0
#> 
#> $strategy
#> [1] "median"
#> 
#> $estimate
#> [1] 0
#> 
#> $n
#> [1] 8
#> 
#> $method
#> [1] "Median / mode imputation"
#>