
Median imputation with a missingness indicator (Geron Ch 2, morie.fn hmimp)
Source:R/geron_ml2_native.R
morie_geron_imputation_median.RdNumeric 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).
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"
#>