You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The dataset you are working with has more variables than observations. By default, MICE imputes missing values for each variable by regressing it against all other variables. This leads to an underdetermined least squares fit in your case.
One way to resolve this is to provide imputation formulas for all variables with missing values (like you have already done with "Sweetener").
We are close to merging a PR that will allow regularized regression to be used in MICE. This will allow you to do something like below:
I reduced the number of columns to 7, but now I am getting another error. SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame
@kshedden a question unrelated to this ticket. If I use .set_imputer for only one variable and do .update_all, is it supposed to output identical result to that of MICE(...).fit() given that formulas are identical?
set_imputer is called behind the scenes for every variable when MICEData is initialized. When you call set_imputer manually, it is just an opportunity to redefine the imputation scheme for one variable using non-default values. If you call set_imputer with the defaults, it should have no effect.
Activity
kshedden commentedon Mar 24, 2018
The dataset you are working with has more variables than observations. By default, MICE imputes missing values for each variable by regressing it against all other variables. This leads to an underdetermined least squares fit in your case.
One way to resolve this is to provide imputation formulas for all variables with missing values (like you have already done with "Sweetener").
We are close to merging a PR that will allow regularized regression to be used in MICE. This will allow you to do something like below:
BekzodR commentedon Mar 24, 2018
I reduced the number of columns to 7, but now I am getting another error.
SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrameI am passing the original dataframe.
kshedden commentedon Mar 24, 2018
That is a common Pandas warning, see e.g. the link below. I think it can be ignored here.
https://www.dataquest.io/blog/settingwithcopywarning/
BekzodR commentedon Mar 24, 2018
Thanks for the info.
BekzodR commentedon Mar 24, 2018
@kshedden a question unrelated to this ticket. If I use .set_imputer for only one variable and do .update_all, is it supposed to output identical result to that of MICE(...).fit() given that formulas are identical?
kshedden commentedon Mar 24, 2018
set_imputer is called behind the scenes for every variable when MICEData is initialized. When you call set_imputer manually, it is just an opportunity to redefine the imputation scheme for one variable using non-default values. If you call set_imputer with the defaults, it should have no effect.
statsmodels/statsmodels/imputation/mice.py
Line 245 in d9eacb0