Skip to content

Commit

Permalink
rfctr: use bases instead of margin in MR std error
Browse files Browse the repository at this point in the history
  • Loading branch information
ernestoarbitrio committed Jun 25, 2020
1 parent fd6be6d commit e92df74
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/cr/cube/cubepart.py
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,7 @@ def standard_deviation(self):
def standard_error(self):
""" -> np.ndarray, percentages standard error"""
if self.dimension_types[0] == DT.MR:
return np.sqrt(self._variance / self.rows_margin)
return np.sqrt(self._variance / self.bases)
return np.sqrt(self._variance / np.sum(self.rows_margin))

@lazyproperty
Expand Down
18 changes: 9 additions & 9 deletions tests/integration/test_cubepart.py
Original file line number Diff line number Diff line change
Expand Up @@ -1471,15 +1471,15 @@ def it_provides_std_dev_err_univ_mr_with_hs(self):
np.testing.assert_almost_equal(
strand.standard_error,
[
0.0045332,
0.0050433,
0.0053114,
0.0051373,
0.0052165,
0.0052914,
0.0054104,
0.0040772,
0.0054158,
0.0025417,
0.0019624,
0.0012875,
0.0017755,
0.0015832,
0.0013577,
0.0008269,
0.002721,
0.000792,
],
)

Expand Down
4 changes: 1 addition & 3 deletions tests/integration/test_multiple_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ def test_std_dev_err_simple_mr():
np.testing.assert_almost_equal(
strand.standard_deviation, [0.4898979, 0.4714045, 0.0]
)
np.testing.assert_almost_equal(
strand.standard_error, [0.2828427, 0.2357023, np.nan]
)
np.testing.assert_almost_equal(strand.standard_error, [0.219089, 0.1924501, 0.0])


def test_1D_mr_with_means():
Expand Down

0 comments on commit e92df74

Please sign in to comment.