directional_outlyingness_stats#

skfda.exploratory.outliers.directional_outlyingness_stats(fdatagrid, *, multivariate_depth=None, pointwise_weights=None)[source]#

Compute the directional outlyingness of the functional data.

Furthermore, it calculates functional, mean and the variational directional outlyingness of the samples in the data set, which are also returned.

The functional directional outlyingness can be seen as the overall outlyingness, analog to other functional outlyingness measures.

The mean directional outlyingness, describes the relative position (including both distance and direction) of the samples on average to the center curve; its norm can be regarded as the magnitude outlyingness.

The variation of the directional outlyingness, measures the change of the directional outlyingness in terms of both norm and direction across the whole design interval and can be regarded as the shape outlyingness.

Firstly, the directional outlyingness is calculated as follows:

\[\mathbf{O}\left(\mathbf{X}(t) , F_{\mathbf{X}(t)}\right) = \left\{\frac{1}{d\left(\mathbf{X}(t) , F_{\mathbf{X}(t)}\right)} - 1 \right\} \cdot \mathbf{v}(t)\]

where \(\mathbf{X}\) is a stochastic process with probability distribution \(F\), \(d\) a depth function and \(\mathbf{v}(t) = \left\{ \mathbf{X}(t) - \mathbf{Z}(t)\right\} / \lVert \mathbf{X}(t) - \mathbf{Z}(t) \rVert\) is the spatial sign of \(\left\{\mathbf{X}(t) - \mathbf{Z}(t)\right\}\), \(\mathbf{Z}(t)\) denotes the median and \(\lVert \cdot \rVert\) denotes the \(L_2\) norm.

From the above formula, we define the mean directional outlyingness as:

\[\mathbf{MO}\left(\mathbf{X} , F_{\mathbf{X}}\right) = \int_I \mathbf{O}\left(\mathbf{X}(t) , F_{\mathbf{X}(t)}\right) \cdot w(t) dt;\]

and the variation of the directional outlyingness as:

\[VO\left(\mathbf{X} , F_{\mathbf{X}}\right) = \int_I \lVert\mathbf{O} \left(\mathbf{X}(t), F_{\mathbf{X}(t)}\right)-\mathbf{MO}\left( \mathbf{X} , F_{\mathbf{X}}\right) \rVert^2 \cdot w(t) dt\]

where \(w(t)\) a weight function defined on the domain of \(\mathbf{X}\), \(I\).

Then, the total functional outlyingness can be computed using these values:

\[FO\left(\mathbf{X} , F_{\mathbf{X}}\right) = \lVert \mathbf{MO}\left( \mathbf{X} , F_{\mathbf{X}}\right)\rVert^2 + VO\left(\mathbf{X} , F_{\mathbf{X}}\right) .\]
Parameters:
  • fdatagrid (FDataGrid) – Object containing the samples to be ordered according to the directional outlyingness.

  • multivariate_depth (depth measure, optional) – Method used to order the data. Defaults to projection depth.

  • pointwise_weights (array_like, optional) – an array containing the weights of each point of discretization where values have been recorded. Defaults to the same weight for each of the points: 1/len(interval).

Returns:

DirectionalOutlyingnessStats object.

Return type:

DirectionalOutlyingnessStats

Example

>>> data_matrix = [[1, 1, 2, 3, 2.5, 2],
...                [0.5, 0.5, 1, 2, 1.5, 1],
...                [-1, -1, -0.5, 1, 1, 0.5],
...                [-0.5, -0.5, -0.5, -1, -1, -1]]
>>> grid_points = [0, 2, 4, 6, 8, 10]
>>> fd = FDataGrid(data_matrix, grid_points)
>>> stats = directional_outlyingness_stats(fd)
>>> stats.directional_outlyingness
array([[[ 1.33333333],
        [ 1.33333333],
        [ 2.33333333],
        [ 1.5       ],
        [ 1.66666667],
        [ 1.66666667]],
       [[ 0.        ],
        [ 0.        ],
        [ 0.        ],
        [ 0.        ],
        [ 0.        ],
        [ 0.        ]],
       [[-1.33333333],
        [-1.33333333],
        [-1.        ],
        [-0.5       ],
        [-0.33333333],
        [-0.33333333]],
       [[-0.66666667],
        [-0.66666667],
        [-1.        ],
        [-2.5       ],
        [-3.        ],
        [-2.33333333]]])
>>> stats.functional_directional_outlyingness
array([ 6.58864198,  6.4608642 ,  6.63753086,  7.40481481])
>>> stats.mean_directional_outlyingness
array([[ 1.66666667],
       [ 0.        ],
       [-0.8       ],
       [-1.74444444]])
>>> stats.variation_directional_outlyingness
array([ 0.12777778,  0.        ,  0.17666667,  0.94395062])

References

Dai, Wenlin, and Genton, Marc G. “Directional outlyingness for multivariate functional data.” Computational Statistics & Data Analysis 131 (2019): 50-65.