Skip to content

Commit f26c332

Browse files
Fix percentile estimator Javadoc to match ceil(p*N)-1 implementation
The Javadoc for MonteCarloRequest.percentiles still described the old floor(p*N) estimator after the implementation was changed to ceil(p*N)-1. Updated to accurately describe the current behavior and note cross-platform parity with Axis2/C. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 6433ce5 commit f26c332

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

  • modules/samples/userguide/src/userguide/springbootdemo-tomcat11/src/main/java/userguide/springboot/webservices

modules/samples/userguide/src/userguide/springbootdemo-tomcat11/src/main/java/userguide/springboot/webservices/MonteCarloRequest.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -192,17 +192,16 @@ public class MonteCarloRequest {
192192
* tail probability directly.
193193
*
194194
* <p>Estimator convention (important for reconciliation):
195-
* This service uses {@code floor(p × N)} to index into the
195+
* This service uses {@code ceil(p × N) − 1} to index into the
196196
* ascending-sorted final-value array. For {@code p = 0.05} and
197-
* {@code N = 10,000} that means index 500, which is the 501-st
198-
* smallest outcome. Some risk systems instead use
199-
* {@code ceil(p × N) − 1} (index 499, the 500-th smallest). The
200-
* two conventions differ by exactly one observation and produce
201-
* VaR estimates that agree to O(1/N) — immaterial for typical
202-
* N &gt; 1,000 but worth noting when reconciling against another
203-
* system. The estimator here matches the CVaR estimator in the
204-
* service (CVaR averages indices 0 .. floor(p × N) − 1, so VaR is
205-
* the first value OUTSIDE that tail set).
197+
* {@code N = 10,000} that selects index 499 (the 500th smallest
198+
* outcome). This corresponds to the k-th order statistic such
199+
* that at least {@code p × N} observations are less than or equal
200+
* to the VaR level — a standard quantile definition. Some risk
201+
* systems use {@code floor(p × N)} (index 500, the 501st smallest),
202+
* which differs by exactly one observation; the difference is
203+
* O(1/N) and immaterial for typical N &gt; 1,000. This estimator
204+
* matches Axis2/C for cross-platform reconciliation.
206205
*
207206
* <p>Default: [0.01, 0.05] (1% and 5% tail, i.e., 99% and 95% VaR).
208207
* Up to 8 entries; extras are silently truncated.

0 commit comments

Comments
 (0)