cl_sop
Notedocblock
cl_sop(sop_dgp, lam, L0, cl_init, d1, d2;
reps_final, reps_bracket, bracket_step,
arl_truncation_factor, chart_choice, refinement,
verbose, cl_tol, seed)Compute the critical limit cl for a EWMA control chart such that the in-control Average Run Length (ARL) equals L0.
The search proceeds in two phases:
- Bracketing: A coarse Monte Carlo estimate (using
reps_bracketreplications) steps away fromcl_initin increments ofbracket_stepuntil an interval[a, b]is found where the ARL crossesL0. - Refinement: The ITP root-finding algorithm narrows the bracket to within
cl_tolusing full Monte Carlo estimates (reps_finalreplications). Using a fixedseedensures the ARL function behaves smoothly across evaluations within a single call, which is required for the root finder to work reliably. With largereps_final, the result is accurate regardless of which seed is used. Passseed=nothing(default) for independent results across calls, or fix the seed for reproducibility.
Arguments
sop_dgp::ICSTS: Data-generating process under the in-control distribution.lam: EWMA smoothing parameter λ ∈ (0, 1].L0: Target in-control ARL.cl_init: Initial guess for the critical limit. Does not need to be precise — a rough value in the right ballpark is sufficient.d1,d2: Integer parameters passed to the ARL simulation.
Keyword Arguments
reps_final=10_000: Replications used during the ITP refinement phase. Increase for a more accurate result.reps_bracket=1_000: Replications used during the bracketing phase. Fewer replications are sufficient here since only the sign ofARL - L0matters.bracket_step=0.01: Step size for the bracketing search.arl_truncation_factor=50: Individual simulation runs are capped atarl_truncation_factor * L0steps. Prevents excessive compute whenclis far from the root during bracketing.chart_choice=TauTilde(): Control chart statistic to use.refinement=OrdinaryType(): SOP classification; aRefinedTypeapplies a refined chart computation.cl_tol=1e-4: Absolute convergence tolerance onclfor the ITP phase.seed=nothing: Random seed for reproducibility. Ifnothing, a fresh seed is drawn each call. Fix to an integer (e.g.seed=42) to get the same result across runs.verbose=false: Iftrue, printscland ARL at each function evaluation.
Returns
cl::Float64: The critical limit achieving an in-control ARL ofL0.
Example
cl = cl_sop(dgp, 0.1, 370.0, 2.5, 3, 5; reps_final=50_000, seed=42)