Omgaan met missende data met imputaties in R
Michal Oleszak
Machine Learning Engineer

In bijna de helft van de studies verdwijnen kernresultaten
Bootstrapping = rijen trekken met teruglegging tot originele grootte


Voordelen:
Nadelen:
calc_correlation <- function(data, indices) {
# Geef de correlatiecoëfficiënt terug
return(corr_coeff)
}
calc_correlation <- function(data, indices) {
# Neem bootstrap-steekproef
data_boot <- data[indices, ]
# Geef de correlatiecoëfficiënt terug
return(corr_coeff)
}
calc_correlation <- function(data, indices) {
# Neem bootstrap-steekproef
data_boot <- data[indices, ]
# Imputeer met kNN-imputatie
data_imp <- kNN(data_boot)
# Geef de correlatiecoëfficiënt terug
return(corr_coeff)
}
calc_correlation <- function(data, indices) {
# Neem bootstrap-steekproef
data_boot <- data[indices, ]
# Imputeer met kNN-imputatie
data_imp <- kNN(data_boot)
# Bereken correlatie tussen Weight en TotChol
corr_coeff <- cor(data_imp$Weight, data_imp$TotChol)
# Geef de correlatiecoëfficiënt terug
return(corr_coeff)
}
library(boot)
boot_results <- boot(nhanes, statistic = calc_correlation, R = 50)
print(boot_results)
ORDINARY NONPARAMETRIC BOOTSTRAP
Call:
boot(data = nhanes, statistic = calc_correlation, R = 50)
Bootstrap Statistics :
original bias std. error
t1* 0.03028306 0.007385452 0.04207152
plot(boot_results)

boot_ci <- boot.ci(boot_results, conf = 0.95, type = "norm")
print(boot_ci)
BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
Based on 50 bootstrap replicates
CALL :
boot.ci(boot.out = boot_results, conf = 0.95, type = "norm")
Intervals :
Level Normal
95% (-0.0596, 0.1054 )
Calculations and Intervals on Original Scale
Omgaan met missende data met imputaties in R