Пример #1
0
 def test_single_random_variable(self):
     frame = model_frame("~ 1 | Subject", self.data)
     assert frame.response is None
     assert frame.coef_model_matrix.shape == (180, 1)
     assert frame.ranef_model_matrix.shape == (
         180,
         len(np.unique(self.data["Subject"])),
     )
Пример #2
0
 def test_another_combination_of_variables(self):
     frame = model_frame("~ Days + (Days | Subject)", self.data)
     assert frame.response is None
     assert frame.coef_model_matrix.shape == (180, 2)
     assert frame.ranef_model_matrix.shape == (
         180,
         2 * len(np.unique(self.data["Subject"])),
     )
Пример #3
0
 def test_final_combination_of_variables(self):
     frame = model_frame("~ (Days + Reaction | Subject)", self.data)
     assert frame.response is None
     assert frame.coef_model_matrix.shape == (180, 1)
     assert frame.ranef_model_matrix.shape == (
         180,
         3 * len(np.unique(self.data["Subject"])),
     )
Пример #4
0
 def test_full_formula(self):
     frame = model_frame("Reaction ~ Days + (Days | Subject)", self.data)
     assert frame.response.shape == (180,)
     assert len(frame.ranef_list) == 1
     assert frame.coef_model_matrix.shape == (180, 2)
     assert frame.ranef_model_matrix.shape == (
         180,
         2 * len(np.unique(self.data["Subject"])),
     )
Пример #5
0
 def test_single_fixed_variable(self):
     frame = model_frame("~ Days", self.data)
     assert frame.response is None
     assert frame.ranef_list is None
     assert frame.ranef_model_matrix is None
     assert frame.coef_model_matrix.shape == (180, 2)
Пример #6
0
 def test_bad_response(self):
     with pytest.raises(ValueError):
         model_frame("x ~ ", self.data)
Пример #7
0
 def test_bad_formula_3(self):
     with pytest.raises(ValueError):
         model_frame("~ Subject ++ Days", self.data)
Пример #8
0
 def test_bad_formula(self):
     with pytest.raises(ValueError):
         model_frame("~ Days + Reaction | Subject", self.data)
Пример #9
0
 def test_response(self):
     frame = model_frame("Reaction ~ ", self.data)
     assert frame.response.shape == (180,)
     assert frame.coef_model_matrix is None
     assert frame.ranef_model_matrix is None