make_chi2_penalty#

make_chi2_penalty(n_params: int, n: int) float[source][source]#

Create a chi-square penalty.

The penalty is the default penalty for the CAPA algorithm. It is described as “penalty regime 1” in the MVCAPA article [1]. The penalty is based on a probability bound on the chi-squared distribution.

The penalty is given by n_params + 2 * sqrt(n_params * log(n)) + 2 * log(n), where n is the sample size and n_params is the total number of parameters per segment in the model across all variables.

Parameters:
n_paramsint

Number of model parameters per segment.

nint

Sample size.

Returns:
float

The chi-square penalty value.

References

[1]

Fisch, A. T., Eckley, I. A., & Fearnhead, P. (2022). Subset multivariate segment and point anomaly detection. Journal of Computational and Graphical Statistics, 31(2), 574-585.