msplot function

Outlier Detection using Magnitude-Shape Plot (MS-Plot) based on the directional outlyingness for functional data.

Outlier Detection using Magnitude-Shape Plot (MS-Plot) based on the directional outlyingness for functional data.

This function finds outliers in univariate and multivariate functional data using the MS-Plot method described in Dai and Genton (2018) tools:::Rd_expr_doi("10.1080/10618600.2018.1473781") . Indices of observations flagged as outliers are returned. In addition, the scatter plot of VOVO against MOMO (||MO||) can be requested for univariate (multivariate) functional data.

msplot( dts, data_depth = c("random_projections"), n_projections = 200, seed = NULL, return_mvdir = TRUE, plot = TRUE, plot_title = "Magnitude Shape Plot", title_cex = 1.5, show_legend = T, ylabel = "VO", xlabel )

Arguments

  • dts: A matrix/data frame for univariate functional data (of size nn

    observations by pp domain points) or a 33-dimensional array for multivariate functional data (of size nn observations by pp

    domain points by dd dimension).

  • data_depth: The depth used in the computation of the directional outlyingness of dts. The projection depth is always used. Support for other depth methods will be added.

  • n_projections: The number of random directions to generate for computing the random projection depth. By default 200 directions are generated.

  • seed: An integer indicating the seed to set when generating random directions for computing the random projection depth. NULL by default in which case no seed is set.

  • return_mvdir: A logical value indicating whether to return the mean and variation of directional outlyingness (MOMO and VOVO). For univariate functional data, MOMO and VOVO are vectors. For multivariate functional data, VOVO is a vector while MOMO is a matrix of size nxdn x d.

  • plot: A logical indicating whether to make the msplot of VOVO against MOMO. In the case of multivariate functional data, a plot of VOVO against MO||MO|| is made.

  • plot_title: The title of the plot. Set to "Magnitude Shape Plot" by default. Ignored if plot = FALSE.

  • title_cex: Numerical value indicating the size of the plot title relative to the device default. Set to 1.5 by default. Ignored if plot = FALSE.

  • show_legend: A logical indicating whether to add legend to plot if plot = TRUE.

  • ylabel: The label of the y-axis. Set to "VO" by default.

  • xlabel: The label of the x-axis if plot = TRUE. If not specified (default), set to "MO" for univariate functional data and "||MO||" for multivariate functional data.

Returns

Returns a list containing: - outliers_index: an integer vector containing the indices of the outliers.

  • median_curve: the index of the median function (which is the function with the smallest robust mahalanobis distance computed from the matrix whose columns are made up of MOMO and VOVO).

  • mean_outlyingness: if return_mvdir = TRUE, a numeric vector of the mean of directional outlyingness for univariate functional data or an nxdn x d matrix of the mean of directional outlyingness for multivariate functional data.

  • var_outlyingness: if return_mvdir = TRUE, a numeric vector of length nn observations containing the variation of directional outlyingness.

Details

MS-Plot finds outliers by computing the mean and variation of directional outlyingness (MOMO and VOVO) described in Dai and Genton (2019) tools:::Rd_expr_doi("10.1016/j.csda.2018.03.017") . A multivariate data whose columns are the computed MOMO and VOVO is then constructed and the robust mahalanobis distance(s) of the rows of this matrix are computed (using the minimum covariate determinant estimate of the location and scatter). The tail of the distribution of these distances is approximated using the FF distribution according to Hardin and Rocke (2005) tools:::Rd_expr_doi("10.1198/106186005X77685") to get the cutoff. The projection depth is always used for computing the directional outlyingness (as suggested by Dai and Genton (2019) tools:::Rd_expr_doi("10.1016/j.csda.2018.03.017") ).

Examples

# Univariate magnitude model in Dai and Genton (2018). dt1 <- simulation_model1() msplot_object <- msplot(dts = dt1$data) msplot_object$outliers_index msplot_object$mean_outlyingness msplot_object$var_outlyingness

References

Dai, W., and Genton, M. G. (2018). Multivariate functional data visualization and outlier detection. Journal of Computational and Graphical Statistics, 27(4), 923-934.

Dai, W., and Genton, M. G. (2019). Directional outlyingness for multivariate functional data. Computational Statistics & Data Analysis, 131, 50-65.

Hardin, J., and Rocke, D. M. (2005). The distribution of robust distances. Journal of Computational and Graphical Statistics, 14(4), 928-946.

See Also

dir_out for directional outlyingness and projection_depth

for multivariate projection depth.

Author(s)

Oluwasegun Taiwo Ojo.

  • Maintainer: Oluwasegun Taiwo Ojo
  • License: GPL-3
  • Last published: 2023-09-30