def test_clean_control_specs_missing_observation_drop_observation(self): self.data.loc[2, 'c2'] = np.nan self.controls_with_missings = 'drop_observations' msp._clean_controls_specification(self) res = [['c1', 'c2'], ['c1', 'c2']] assert_equal(self.controls, res) aae(self.obs_to_keep, np.array([True, True, False, True, True]))
def test_clean_control_specs_missing_observations_drop_variable(self): self.data.loc[2, 'c2'] = np.nan msp._clean_controls_specification(self) res = [['c1'], ['c1', 'c2']] assert_equal(self.controls, res) aae(self.obs_to_keep, np.ones(5, dtype=bool))
def test_clean_control_specs_missing_variable(self): self._present = Mock(side_effect=[True, False, True, True]) msp._clean_controls_specification(self) res = [['c1'], ['c1', 'c2']] assert_equal(self.controls, res) aae(self.obs_to_keep, np.ones(5, dtype=bool))
def test_clean_control_specs_nothing_to_clean(self): msp._clean_controls_specification(self) res = [['c1', 'c2'], ['c1', 'c2']] assert_equal(self.controls, res) aae(self.obs_to_keep, np.ones(5, dtype=bool))
def test_clean_control_specs_missing_observation_drop_observation(self): self.data.loc[2, "c2"] = np.nan self.controls_with_missings = "drop_observations" ModelSpecProcessor._clean_controls_specification(self) res = (("c1", "c2"), ("c1", "c2")) assert_equal(self.controls, res)
def test_clean_control_specs_missing_variable(self): self._present = Mock(side_effect=[True, False, True, True]) ModelSpecProcessor._clean_controls_specification(self) res = (("c1",), ("c1", "c2")) assert_equal(self.controls, res)
def test_clean_control_specs_nothing_to_clean(self): ModelSpecProcessor._clean_controls_specification(self) res = (("c1", "c2"), ("c1", "c2")) assert_equal(self.controls, res)