@@ -91,12 +91,14 @@ def test__geographical_pooling(self, min_obs, expected):
91
91
92
92
@pytest .mark .parametrize ("min_obs, expected_pos_prop, expected_se, expected_sample_sz" , [
93
93
(3 , # one case of tests < min_obs
94
- np .array ([np .nan , 1 / 2 , 1 / 2 , 4 / 10 ]),
95
- np .array ([np .nan , np .sqrt (0.25 / 4 ), np .sqrt (0.25 / 6 ), np .sqrt (0.24 / 10 )]),
94
+ np .array ([np .nan , 2.5 / 5 , 3.5 / 7 , 4.5 / 11 ]),
95
+ np .array ([np .nan , np .sqrt (2.5 * (5 - 2.5 )/ 5 / 5 / 4 ), np .sqrt (3.5 * (7 - 3.5 )/ 7 / 7 / 6 ),
96
+ np .sqrt (4.5 * (11 - 4.5 )/ 11 / 11 / 10 )]),
96
97
np .array ([np .nan , 4 , 6 , 10 ])),
97
98
(1 , # no cases of tests < min_obs
98
- np .array ([1 / 2 , 2 / 4 , 3 / 6 , 4 / 10 ]),
99
- np .array ([np .sqrt (0.25 / 2 ), np .sqrt (0.25 / 4 ), np .sqrt (0.25 / 6 ), np .sqrt (0.24 / 10 )]),
99
+ np .array ([1.5 / 3 , 2.5 / 5 , 3.5 / 7 , 4.5 / 11 ]),
100
+ np .array ([np .sqrt (1.5 * (3 - 1.5 )/ 3 / 3 / 2 ), np .sqrt (2.5 * (5 - 2.5 )/ 5 / 5 / 4 ),
101
+ np .sqrt (3.5 * (7 - 3.5 )/ 7 / 7 / 6 ), np .sqrt (4.5 * (11 - 4.5 )/ 11 / 11 / 10 )]),
100
102
np .array ([2 , 4 , 6 , 10 ])),
101
103
])
102
104
def test_raw_positive_prop (self , min_obs , expected_pos_prop , expected_se , expected_sample_sz ):
@@ -123,16 +125,18 @@ def test_raw_positive_prop(self, min_obs, expected_pos_prop, expected_se, expect
123
125
2 ,
124
126
None ,
125
127
None ,
126
- np .array ([np .nan , 1 / 2 , 1 / 2 , 7 / 16 ]),
127
- np .array ([np .nan , np .sqrt (0.25 / 6 ), np .sqrt (0.25 / 10 ), np .sqrt (63 / 256 / 16 )]),
128
+ np .array ([np .nan , 3.5 / 7 , 5.5 / 11 , 7.5 / 17 ]),
129
+ np .array ([np .nan , np .sqrt (3.5 * (7 - 3.5 )/ 7 / 7 / 6 ), np .sqrt (5.5 * (11 - 5.5 )/ 11 / 11 / 10 ),
130
+ np .sqrt (7.5 * (17 - 7.5 )/ 17 / 17 / 16 )]),
128
131
np .array ([np .nan , 6 , 10 , 16 ]),
129
132
),
130
133
(3 , # parents case
131
134
2 ,
132
135
np .array ([3 , 7 , 9 , 11 ]),
133
136
np .array ([5 , 10 , 15 , 20 ]),
134
- np .array ([1.6 / 3 , 1 / 2 , 1 / 2 , 7 / 16 ]),
135
- np .array ([np .sqrt (56 / 225 / 3 ), np .sqrt (0.25 / 6 ), np .sqrt (0.25 / 10 ), np .sqrt (63 / 256 / 16 )]),
137
+ np .array ([(1 + 0.6 + 0.5 )/ (2 + 1 + 1 ), 3.5 / 7 , 5.5 / 11 , 7.5 / 17 ]),
138
+ np .array ([np .sqrt (2.1 * (4 - 2.1 )/ 4 / 4 / 3 ), np .sqrt (3.5 * (7 - 3.5 )/ 7 / 7 / 6 ),
139
+ np .sqrt (5.5 * (11 - 5.5 )/ 11 / 11 / 10 ), np .sqrt (7.5 * (17 - 7.5 )/ 17 / 17 / 16 )]),
136
140
np .array ([3 , 6 , 10 , 16 ]),
137
141
),
138
142
])
0 commit comments