dir_out: Dai & Genton (2019) Directional outlyingness for univariate...

View source: R/directional_outlyingness.R

dir_outR Documentation

Dai & Genton (2019) Directional outlyingness for univariate or multivariate functional data.

Description

Compute the directional outlyingness of a univariate or multivariate functional data based on Dai and Genton (2019) \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.csda.2018.03.017")} and Dai and Genton (2018) \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1080/10618600.2018.1473781")}.

Usage

dir_out(
  dts,
  data_depth = "random_projections",
  n_projections = 200L,
  seed = NULL,
  return_distance = TRUE,
  return_dir_matrix = FALSE
)

Arguments

dts

A matrix (or data frame) for univariate functional data (of size n observations by p domain points) or a 3-dimensional array for multivariate functional data (of size n observations by p domain points by d dimension).

data_depth

The method for computing the depth. The random projection depth is always used as suggested in Dai and Genton (2018) \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1080/10618600.2018.1473781")}. Support for more depth methods will be added.

n_projections

The number of directions for computing random projection depth. By default, 200 random directions are generated from a scaled uniform distribution between -1 and 1.

seed

An integer indicating the seed to set when generating the random directions. Defaults to NULL in which case a seed is not set.

return_distance

A logical value. If TRUE, returns: a matrix whose columns are the mean and variation of directional outlyingness, the mahalanobis distance of the observations of this matrix, and the robust estimate of the mean and covariance of this matrix (computed using the minimum covariance determinant method).

return_dir_matrix

A logical value. If TRUE, returns the directional outlyingness matrix (or array for multivariate functional data). Computed from the chosen depth_depth.

Details

The directional outlyingness, as defined in Dai and Genton (2019) \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.csda.2018.03.017")} is

O(Y, F_Y) = (1/d(Y, F_Y) - 1).v

where d is a depth notion, and v is the unit vector pointing from the median of F_Y to Y. For univariate and multivariate functional data, the projection depth is always used as suggested by Dai and Genton (2019) \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.csda.2018.03.017")}.

Value

Returns a list containing:

mean_outlyingness

an n x d matrix of the mean of directional outlyingness.

var_outlyingness

a vector of length n containing the variation of directional outlyingness.

ms_matrix

ifreturn_distance = T, an n x (d+1) matrix whose columns are the mean and variation of directional outlyingness.

distance

if return_distance = T, a vector of distance computed from the ms_matrix using a robust estimate of the mean and covariance matrix.

mcd_obj

if return_distance = T, a list containing the robust (minimum covariance determinant) estimate of the mean and covariance of the ms_matrix.

dirout_matrix

if return_dir_matrix = T, an n x p (or n x p x d) matrix (or array) containing the directional outlyingness values for the univariate (or multivariate) functional dts.

Author(s)

Oluwasegun Taiwo Ojo.

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.

Zuo, Y. (2003). Projection-based depth functions and associated medians. The Annals of Statistics, 31(5), 1460-1490.

See Also

msplot for outlier detection using msplot and projection_depth for multivariate projection depth.

Examples

# univariate magnitude model in Dai and Genton (2018).
dt4 <- simulation_model4()
dirout_object <- dir_out(dts = dt4$data, return_distance = TRUE)

fdaoutlier documentation built on Oct. 1, 2023, 1:06 a.m.