def _estimate_scale(self, resid): """ Estimates the scale based on the option provided to the fit method. """ if isinstance(self.scale_est, str): if self.scale_est.lower() == 'mad': return scale.mad(resid, center=0) else: raise ValueError("Option %s for scale_est not understood" % self.scale_est) elif isinstance(self.scale_est, scale.HuberScale): return self.scale_est(self.df_resid, self.nobs, resid) else: return scale.scale_est(self, resid)**2
def test_axisneg1(self): m = scale.mad(self.X, axis=-1) assert_equal(m.shape, (40, 10))
def test_axis2(self): m = scale.mad(self.X, axis=2) assert_equal(m.shape, (40, 10))
def test_axis1(self): m = scale.mad(self.X, axis=1) assert_equal(m.shape, (40, 30))
def test_axis0(self): m = scale.mad(self.X, axis=0) assert_equal(m.shape, (10, 30))
def test_mad_center(self): n = scale.mad(self.X, center=0) assert_equal(n.shape, (10, ))
def test_mad(self): m = scale.mad(self.X) assert_equal(m.shape, (10, ))
def test_mad(self): assert_almost_equal(scale.mad(self.chem), 0.52632, DECIMAL)