def next(self): results = self.results self.weights = self.M.weights((results.Y - results.predict) / N.sqrt(results.scale)) self.initialize(self.design) results = wls_model.fit(self, results.Y) self.scale = results.scale = self.estimate_scale(results) self.iter += 1 return results
def fit(self, Y): iter(self) self.results = wls_model.fit(self, Y) self.scale = self.results.scale = self.estimate_scale(self.results) while self.cont(self.results): self.results = self.next() return self.results