Пример #1
0
 def test_compute_effsize_from_t(self):
     """Test function compute_effsize_from_t"""
     tval, nx, ny = 2.90, 35, 25
     compute_effsize_from_t(tval, nx=nx, ny=ny, eftype='hedges')
     tval, N = 2.90, 60
     compute_effsize_from_t(tval, N=N, eftype='cohen')
     # Wrong desired eftype
     with pytest.raises(ValueError):
         compute_effsize_from_t(tval, nx=x, ny=y, eftype='wrong')
     # T is not a float
     with pytest.raises(ValueError):
         compute_effsize_from_t([1, 2, 3], nx=nx, ny=ny)
     # No sample size info
     with pytest.raises(ValueError):
         compute_effsize_from_t(tval)
     # Compare with Lakens spreadsheet: https://osf.io/vbdah/
     assert np.isclose(compute_effsize_from_t(1.1, N=31), 0.395131664)
     assert np.isclose(compute_effsize_from_t(1.74, nx=6, ny=6), 1.00458946)
     assert np.isclose(compute_effsize_from_t(2.5, nx=10, ny=14), 1.0350983)
Пример #2
0
 def test_compute_effsize_from_t(self):
     """Test function compute_effsize_from_t"""
     tval, nx, ny = 2.90, 35, 25
     compute_effsize_from_t(tval, nx=nx, ny=ny, eftype='hedges')
     tval, N = 2.90, 60
     compute_effsize_from_t(tval, N=N, eftype='cohen')
     # Wrong desired eftype
     with pytest.raises(ValueError):
         compute_effsize_from_t(tval, nx=x, ny=y, eftype='wrong')
     # T is not a float
     with pytest.raises(ValueError):
         compute_effsize_from_t([1, 2, 3], nx=nx, ny=ny)
     # No sample size info
     with pytest.raises(ValueError):
         compute_effsize_from_t(tval)
     # Compare with R
     assert np.allclose(compute_effsize_from_t(1.736465, nx=6, ny=6),
                        1.002549)