make_nonlinear_chi2_penalty#

make_nonlinear_chi2_penalty(n_params_per_variable: int, n: int, p: int) ndarray[source][source]#

Create a nonlinear chi-square penalty.

The penalty is a piece of the default penalty for the MVCAPA algorithm. It is described as “penalty regime 3” in the MVCAPA article [1], suitable for detecting both sparse and dense anomalies in the data. Sparse anomalies only affect a few variables, while dense anomalies affect many/all variables.

Parameters:
n_params_per_variable: int

Number of model parameters per variable and segment.

nint

Sample size.

pint

Number of variables/columns in the data being analysed.

Returns:
np.ndarray

The non-decreasing nonlinear chi-square penalty values. The shape is (p,). Element i of the array is the penalty value for i+1 variables being affected by a change or anomaly.

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.