|
@@ -376,11 +376,19 @@ impl Analyzer for NormalAnalyzer {
|
|
|
if mvn.is_ok() {
|
|
|
let mvn = mvn.unwrap();
|
|
|
|
|
|
+ // Start 3 standard deviations below the mean, based on
|
|
|
+ // 68-95-99.7 rule, assuming the confidence will be high
|
|
|
+ // enough that 99.7 is close enough to "the whole
|
|
|
+ // distribution" to be reasonable
|
|
|
+ let bip_start = (bridge_ips_mean - (3.0 * bridge_ips_f64.std_dev()).ceil()) as i32;
|
|
|
+ let pr_start =
|
|
|
+ (positive_reports_mean - (3.0 * positive_reports_f64.std_dev()).ceil()) as i32;
|
|
|
+
|
|
|
// Estimate the CDF by integrating the PDF by hand with step
|
|
|
// size 1
|
|
|
let mut cdf = 0.0;
|
|
|
- for bip in 0..bridge_ips_today {
|
|
|
- for pr in 0..positive_reports_today {
|
|
|
+ for bip in bip_start..bridge_ips_today as i32 {
|
|
|
+ for pr in pr_start..positive_reports_today as i32 {
|
|
|
cdf += mvn.pdf(&DVector::from_vec(vec![bip as f64, pr as f64]));
|
|
|
}
|
|
|
}
|