Skip to content

Commit

Permalink
Merge 8632c43 into d698217
Browse files Browse the repository at this point in the history
  • Loading branch information
ernestoarbitrio committed Jun 24, 2020
2 parents d698217 + 8632c43 commit 6b2cc47
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
2 changes: 2 additions & 0 deletions src/cr/cube/cubepart.py
Original file line number Diff line number Diff line change
Expand Up @@ -1034,6 +1034,8 @@ def standard_deviation(self):
@lazyproperty
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 / 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.0022361,
0.0017264,
0.0011327,
0.001562,
0.0013928,
0.0011945,
0.0007275,
0.0023938,
0.0006968,
0.0045332,
0.0050433,
0.0053114,
0.0051373,
0.0052165,
0.0052914,
0.0054104,
0.0040772,
0.0054158,
],
)

Expand Down
4 changes: 3 additions & 1 deletion tests/integration/test_multiple_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ 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.185164, 0.1781742, 0.0])
np.testing.assert_almost_equal(
strand.standard_error, [0.2828427, 0.2357023, np.nan]
)


def test_1D_mr_with_means():
Expand Down

0 comments on commit 6b2cc47

Please sign in to comment.