def test_more_than_one_glm_is_ok(self): with Model(): GLM.from_formula('y ~ x', self.data_logistic, family=families.Binomial(link=families.logit), name='glm1') GLM.from_formula('y ~ x', self.data_logistic, family=families.Binomial(link=families.logit), name='glm2')
def test_from_xy(self): with Model(): GLM( self.data_logistic["x"], self.data_logistic["y"], family=families.Binomial(link=families.logit), name="glm1", )
def test_glm_link_func2(self): with Model() as model: GLM.from_formula('y ~ x', self.data_logistic2, family=families.Binomial(priors={'n': self.data_logistic2['n']})) trace = sample(1000, progressbar=False, init='adapt_diag', random_seed=self.random_seed) assert round(abs(np.mean(trace['Intercept'])-self.intercept), 1) == 0 assert round(abs(np.mean(trace['x'])-self.slope), 1) == 0
def test_glm_link_func(self): with Model() as model: GLM.from_formula('y ~ x', self.data_logistic, family=families.Binomial(link=families.logit)) step = Slice(model.vars) trace = sample(1000, step, progressbar=False, random_seed=self.random_seed) assert round(abs(np.mean(trace['Intercept'])-self.intercept), 1) == 0 assert round(abs(np.mean(trace['x'])-self.slope), 1) == 0
def test_glm_link_func2(self): with Model() as model: GLM.from_formula( "y ~ x", self.data_logistic2, family=families.Binomial(priors={"n": self.data_logistic2["n"]}), ) trace = sample(1000, progressbar=False, init="adapt_diag", random_seed=self.random_seed) assert round(abs(np.mean(trace["Intercept"]) - self.intercept), 1) == 0 assert round(abs(np.mean(trace["x"]) - self.slope), 1) == 0
def test_from_xy(self): with Model(): GLM(self.data_logistic['x'], self.data_logistic['y'], family=families.Binomial(link=families.logit), name='glm1')