vorflop_selbst: closed-form test of the flat posterior (mutation smoke second half: 363 mutants, 33 missed before, 3 left in bewerte_s)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1498,6 +1498,23 @@ mod spec {
|
||||
assert!((p.mu[0] - 5.0).abs() < 1e-12 && (p.tau2[0] - 2.75).abs() < 1e-12, "{p:?}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn flacher_posterior_hat_die_geschlossene_form() {
|
||||
// V0 = 0 fest, V1 ~ N(3, 4): R = |V1| / 2, po(1) = P(V1 > 0), w = P(|V1| <= 4) mit eps = 2
|
||||
let mut sc = Akku::neu(2).schaetzung();
|
||||
sc.n = 50;
|
||||
sc.mittel[1] = 3.0;
|
||||
sc.kovm[1][1] = 4.0;
|
||||
let b = bewerte_s(&sc, &[0.5, 0.5], 2.0, 200_000, 9).unwrap();
|
||||
let (mu, sg): (f64, f64) = (3.0, 2.0);
|
||||
let e_abs = sg * (2.0 / std::f64::consts::PI).sqrt() * (-(mu * mu) / (2.0 * sg * sg)).exp() + mu * (1.0 - 2.0 * phi(-mu / sg));
|
||||
let var_abs = sg * sg + mu * mu - e_abs * e_abs;
|
||||
assert!((b.r - e_abs / 2.0).abs() < 0.01, "{} {}", b.r, e_abs / 2.0);
|
||||
assert!((b.r_se - var_abs.sqrt() / 2.0).abs() < 0.01, "{} {}", b.r_se, var_abs.sqrt() / 2.0);
|
||||
assert!((b.po[1] - phi(mu / sg)).abs() < 0.01 && (b.po[0] + b.po[1] - 1.0).abs() < 1e-9);
|
||||
assert!((b.w - (phi((4.0 - mu) / sg) - phi((-4.0 - mu) / sg))).abs() < 0.01, "{}", b.w);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ohne_variable_ist_die_schicht_aus() {
|
||||
// der Test setzt die Variable nicht; `an` liest nur sie
|
||||
|
||||
Reference in New Issue
Block a user