コード例 #1
0
 def test_single_model_does_not_break(self):
     df = load_monotone_missing_data()
     ipm = IPMW(df,
                missing_variable=['B', 'C'],
                stabilized=False,
                monotone=True)
     ipm.regression_models(model_denominator='L')
     ipm.fit()
     x = ipm.Weight
コード例 #2
0
 def test_monotone_example(self):
     # TODO find R or SAS to test against
     df = load_monotone_missing_data()
     ipm = IPMW(df, missing_variable=['B', 'C'], stabilized=False, monotone=True)
     ipm.regression_models(model_denominator=['L + A', 'L + B'])
     ipm.fit()
     df['w'] = ipm.Weight
     dfs = df.dropna(subset=['w'])
     npt.assert_allclose(np.average(dfs['B'], weights=dfs['w']), 0.41877344861340654)
     npt.assert_allclose(np.average(dfs['C'], weights=dfs['w']), 0.5637116735464095)