Conditional Imputation
This is a tutorial on conditional imputation of missing values using
cImpute.
First import some third-party packages and xomics:
import matplotlib.pyplot as plt
import xomics as xo
# Settings
groups = ["d00", "d03", "d07", "d14"]
pp = xo.PreProcess()
# Load data
df_raw = xo.load_dataset()
cols_quant = pp.get_qcols(df=df_raw, groups=groups)
# Imputation
df_imp = xo.cImpute().run(df=df_raw, groups=groups, min_cs=0.5)
d_min, up_mnar, d_max = xo.cImpute().get_limits(df=df_raw, groups=groups)
# Plot histogram
xo.plot_settings()
xo.plot_imput_histo(df_raw=df_raw,
df_imp=df_imp,
d_min=d_min,
up_mnar=up_mnar,
cols_quant=cols_quant)
plt.show()
df_imp = xo.cImpute().run(df=df_raw, groups=groups, min_cs=1)
d_min, up_mnar, d_max = xo.cImpute().get_limits(df=df_raw, groups=groups)
xo.plot_settings()
xo.plot_imput_histo(df_raw=df_raw,
df_imp=df_imp,
d_min=d_min,
up_mnar=up_mnar,
cols_quant=cols_quant)
plt.show()