statsmodels.imputation.mice.MICE¶
-
class
statsmodels.imputation.mice.
MICE
(model_formula, model_class, data, n_skip=3, init_kwds=None, fit_kwds=None)[source]¶ Multiple Imputation with Chained Equations.
This class can be used to fit most Statsmodels models to data sets with missing values using the ‘multiple imputation with chained equations’ (MICE) approach..
Parameters: model_formula : string
The model formula to be fit to the imputed data sets. This formula is for the ‘analysis model’.
model_class : statsmodels model
The model to be fit to the imputed data sets. This model class if for the ‘analysis model’.
data : MICEData instance
MICEData object containing the data set for which missing values will be imputed
n_skip : int
The number of imputed datasets to skip between consecutive imputed datasets that are used for analysis.
init_kwds : dict-like
Dictionary of keyword arguments passed to the init method of the analysis model.
fit_kwds : dict-like
Dictionary of keyword arguments passed to the fit method of the analysis model.
Examples
Run all MICE steps and obtain results:
>>> imp = mice.MICEData(data) >>> fml = 'y ~ x1 + x2 + x3 + x4' >>> mice = mice.MICE(fml, sm.OLS, imp) >>> results = mice.fit(10, 10) >>> print(results.summary())
.. rubric:: Methods
combine
()Pools MICE imputation results. fit
([n_burnin, n_imputations])Fit a model using MICE. next_sample
()Perform one complete MICE iteration. Methods
combine
()Pools MICE imputation results. fit
([n_burnin, n_imputations])Fit a model using MICE. next_sample
()Perform one complete MICE iteration.