Skip to content

general tests

E. F. Haghish edited this page Aug 25, 2022 · 6 revisions

This tests are intended to examine the general arguments of the mlim R package. Run these tests one by one and if the syntax of the package is changing, update this file accordingly. After each test run, specify the version of mlim to know when was the last time this document received an update:

# Load mlim R package and prepare a lighter version of iris dataset for testing
# ===============================================================================
rm(list = ls())
library(mlim)
data("iris")

# reduce the size of the package for faster testing
df <- iris[1:100, c(1,2,5)]

# Add artifitial missing data
# ===============================================================================
dfNA <- mlim.na(df, p = 0.15, stratify = TRUE, seed = 2022)

# Single imputation with ELNET
# ===============================================================================
MLIM <- mlim(dfNA, m=1, seed = 2022) 
print(MLIMerror <- mlim.error(MLIM, dfNA, df))

# Single imputation with GBM, giving it 180 seconds to fine-tune each imputation
# ===============================================================================
GBM <- mlim(dfNA, m=1, algos = "GBM", seed = 2022, tuning_time = 180) 
print(MLIMerror <- mlim.error(GBM, dfNA, df))
Clone this wiki locally