Use of statsmodels.imputation.mice -


i exploring statsmodels.imputation.mice package use imputing missing values. haven't seen example of usage, though, outside of http://www.statsmodels.org. gather, 1 create instance of mice.micedata , use in conjunction mice.mice().fit(). example http://www.statsmodels.org/dev/generated/statsmodels.imputation.mice.mice.html

>>> 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()) 

the imputed values in instance of micedata not fixed, though. mean if

imp = mice.micedata(data) 

every call

imp.update('x1')  

(assuming data has column 'x1') draws new sample missing values using “predictive mean matching”. that's if use miceddata mice.fit(). however, let's want use package impute value values once, , use predictor package, sklearn, fit data. wonder, reasonable approach. can run update several times , average prediction each missing value. alternatively, can create several data sets different imputed values , fit each of sets. however, if data set huge, can pretty expensive.


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -