|
@@ 295-304 (lines=10) @@
|
| 292 |
|
|
| 293 |
|
return sorted(simulated_proportions) |
| 294 |
|
|
| 295 |
|
def confidence_interval(self, confidence_level): |
| 296 |
|
q = 1 - (1 - confidence_level) / 2 |
| 297 |
|
if self.distribution_family == DistributionFamily.normal: |
| 298 |
|
z = norm.ppf(q) |
| 299 |
|
pf = z * self.standard_error |
| 300 |
|
return self.point_estimate - pf, self.point_estimate + pf |
| 301 |
|
else: |
| 302 |
|
threshold1 = int(1000 * (1 - confidence_level) / 2) |
| 303 |
|
threshold2 = int(1000 * q) |
| 304 |
|
return self.diff_simulated_proportions[threshold1], self.diff_simulated_proportions[threshold2] |
| 305 |
|
|
| 306 |
|
|
| 307 |
|
|
|
@@ 187-196 (lines=10) @@
|
| 184 |
|
self.simulated_proportions[i] = float(count) / self.sample_size |
| 185 |
|
self.simulated_proportions = sorted(self.simulated_proportions) |
| 186 |
|
|
| 187 |
|
def confidence_interval(self, confidence_level): |
| 188 |
|
q = 1 - (1 - confidence_level) / 2 |
| 189 |
|
if self.distribution_family == DistributionFamily.normal: |
| 190 |
|
z = norm.ppf(q) |
| 191 |
|
pf = z * self.standard_error |
| 192 |
|
return self.point_estimate - pf, self.point_estimate + pf |
| 193 |
|
else: |
| 194 |
|
threshold1 = int(1000 * (1 - confidence_level) / 2) |
| 195 |
|
threshold2 = int(1000 * q) |
| 196 |
|
return self.simulated_proportions[threshold1], self.simulated_proportions[threshold2] |
| 197 |
|
|
| 198 |
|
|
| 199 |
|
class ProportionDiffSamplingDistribution(object): |