Repository navigation
Mice - #1757
Mice#1757chengfulun wants to merge 92 commits into
Conversation
Started building the simulation switchboard function and initialized the simulate functions. Created class in mice.py for filling in imputations.
Imputer, ImputerChain, and AnalysisChain classes in mice.py, created mice folder, inserted get_distribution switchboard into LikelihoodModelResults in base folder.
halfway through modifying mice.py structure to support chained equations. also did a first pass for OLS's MLE + noise simulation method
changed get_distribution and imputer to do simulation inside the imputer, modified all the classes inside mice.py
Dry run working for linear model.
ran some initial tests and cleaned up the code
implemented combining of parameter estimates for ImputerChain
Changed get_distribution to mirror the predict method and made sure the new version returns the same thing as before up to ImputerCombine.
Added functionality for logistic regression in discrete. Had to create fork in impute_asymptotic_bayes for now, may change design later. Also finished the AnalysisChain class for doing MICE without saving any datasets.
In process of changing ImputerChain class to iterator.
Got MICE method to work by doing away with self.data and instead modifying/returning underlying data directly.
Fixed bug in calculating the perturbed parameter.
Changed scale passed to get_distribution, changed order of imputation so that variable with least missing data is imputed first.
Working version of pmm imputation that matches fairly closely with asymptotic bayes. More testing needed.
Fixed minor bug with usage of scale.
trying to return a results class
Added clarity in several places, and added functionality for pmm choosing over several neighbors.
Made AnalysisChain and ImputerChain iterators. Added a bunch of helper functions like new_imputer and changed store_changes. Added MissingData class. Simplified user interface.
Add intercept if original model had intercept only.
Fixed get_distribution seed issue, restructured MICE run and combine, added method choosing parameters.
Changes to ImputedData and Imputer
Still pending: numpy instance clarification, add_imputations, pval methods, blank lines, trailing whitepsace, and Rhistory.
|
general question on inference and degrees of freedom: If the degrees of freedom for t-test and similar differ across parameters, how are the degrees of freedom determined for tests that involve several parameters. For example, a t-test that two coefficients are the same, however the degrees of freedom for the two coefficients differ. (A related thought, that can be ignored: For two sample t-test with unequal variance and unequal sample sizes we use Satterthwaite df correction which is a weighted average.) I can help with the implementation for t-test confint, ... next week. I just added |
|
I hadn't really thought of this, but the Satterthwaite correction may be |
up to line 279
Test reflects almost-exact replication of R's MICE for logistic regression with normal covariates.
Can specify a dictionary of methods for auto imputation instead of a single method.
finalized mice module for gsoc submission
|
Moved to #2076 |
|
Closing in favor of #2076. |
This is a WIP PR. I have implemented a statsmodels class that receives a dataset with missing values and imputes the missing values using chained equations. It can then fit an analysis model to the fully imputed data. The code gives sensible results for a real dataset but has not been rigorously tested against existing software packages.