Comprehensive verification suite for the A2-MN Newton solver.
Examples
verify_a2_all()
#> ======================================================================
#> Module 11: A2-MN Newton Solver - Full Verification Suite
#> ======================================================================
#>
#> [Test 1] Basic convergence (J=50, mu_K=5, var_K=8)
#> --------------------------------------------------
#> A2-MN Newton Solver
#> Target: E[K]=5.0000, Var(K)=8.0000
#> A1 initialization: a0=4.000000, b0=3.912023
#> --------------------------------------------------------------------------------
#> Iter | a | b | E[K] | Var(K) | ||F|| | step | det(J)
#> --------------------------------------------------------------------------------
#> 1 | 4.000000 | 3.912023 | 4.461351 | 4.783136 | 3.26e+00 | 1.0000 | -5.30e+00
#> 2 | 1.178650 | 0.911969 | 4.909046 | 10.854537 | 2.86e+00 | 1.0000 | -2.16e+01
#> 3 | 1.844384 | 1.455254 | 4.974913 | 8.399473 | 4.00e-01 | 1.0000 | -1.53e+01
#> 4 | 2.029223 | 1.599680 | 4.999187 | 8.013243 | 1.33e-02 | 1.0000 | -1.43e+01
#> 5 | 2.036082 | 1.605046 | 4.999999 | 8.000021 | 2.08e-05 | 1.0000 | -1.43e+01
#> 6 | 2.036093 | 1.605054 | 5.000000 | 8.000000 | 7.60e-09 | --- | -1.43e+01
#>
#> Converged: ||F|| = 7.60e-09 < 1.00e-08
#>
#> Result: PASS
#>
#> [Test 2] Fast convergence (< 10 iterations)
#> --------------------------------------------------
#> Iterations: 6
#> Termination: residual
#> Result: PASS
#>
#> [Test 3] A2 improves over A1
#> --------------------------------------------------
#> A1 vs A2 Comparison (J=50, mu_K=5.00, var_K=8.00)
#> ------------------------------------------------------------
#> A1 A2
#> ------------------------------------------------------------
#> Shape (a) 4.000000 2.036093
#> Rate (b) 3.912023 1.605054
#> E[K] achieved 4.461351 4.9999999992
#> Var achieved 4.783136 8.0000000076
#> Residual 3.261649 7.60e-09
#> ------------------------------------------------------------
#> Improvement ratio: 429143508x
#>
#> Result: PASS
#>
#> [Test 4] Various target scenarios
#> --------------------------------------------------
#> J= 30, mu_K= 3, var_K= 5: PASS (iter=10, term=residual, res=9.09e-10)
#> J= 50, mu_K=10, var_K=15: PASS (iter=6, term=residual, res=3.04e-14)
#> J=100, mu_K= 5, var_K= 8: PASS (iter=6, term=residual, res=3.57e-11)
#> J= 50, mu_K=25, var_K=50: PASS (iter=7, term=residual, res=4.53e-10)
#>
#> [Test 5] Edge case with high VIF (quasi-improper prior)
#> --------------------------------------------------
#> Target: mu_K=3, var_K=10 (VIF=5.0)
#> Converged: TRUE, Iterations: 16
#> Termination: residual
#> Achieved: a=0.293472 (quasi-improper: FALSE)
#> Residual: 4.38e-09
#> Result: PASS
#>
#> [Test 6] Termination field consistency
#> --------------------------------------------------
#> Termination field: 'residual'
#> Valid termination: TRUE
#> Result: PASS
#>
#> [Test 7] Trace contains required diagnostics
#> --------------------------------------------------
#> Required columns: iter, a, b, M1, V, residual, step, det_Jlog
#> Present columns: iter, a, b, M1, V, residual, step, det_Jlog
#> Result: PASS
#>
#> ======================================================================
#> Overall Result: ALL TESTS PASSED
#> ======================================================================