# shape.fd.analysis: Diagnostic Plot for First and Second Order Integrated and... In ddalpha: Depth-Based Classification and Calculation of Data Depth

## Description

Produce the diagnostic plot based on the fist or second order extended integrated / infimal depths.

## Usage

 ```1 2 3``` ```shape.fd.analysis(datafA, datafB, range = NULL, d = 101, order = 1, method = c("halfspace", "simplicial"), approx = 0, title = "", nfun = 10, plot = TRUE) ```

## Arguments

 `datafA` A single function whose depth is computed, represented by a `dataf` object of arguments and functional values. `datafB` Functional dataset with respect to which the depth of `datafA` is computed. `datafB` is represented by a `dataf` object of arguments and functional values. `n` stands for the number of functions. The grid of observation points for the functions in `datafA` and `datafB` may not be the same. `range` The common range of the domain where the functions `datafA` and `datafB` are observed. Vector of length 2 with the left and the right end of the interval. Must contain all arguments given in `datafA` and `datafB`. `d` Grid size to which all the functional data are transformed. For depth computation, all functional observations are first transformed into vectors of their functional values of length `d` corresponding to equi-spaced points in the domain given by the interval `range`. Functional values in these points are reconstructed using linear interpolation, and extrapolation. `order` The order of the depth to be used in the plot, for `order=1` produces the plot of univariate marginal depth of `A` and `nfun` functions from `B` over the domain of the functions. For `order=2` produces the bivariate contour plot of the bivariate depths of `A` at couples of points from the domain. `method` The depth that is used in the diagnostic plot. possible values are `halfspace` for the halfspace depth, or `simplicial` for the simplicial depth. `approx` For `order=2`, the number of approximations used in the computation of the order extended depth. By default this is set to `0`, meaning that the depth is computed at all possible `d^2` combinations of the points in the domain. When set to a positive integer, `approx` bivariate points are randomly sampled in unit square, and at these points the bivariate depths of the corresponding functional values are computed. `title` The title of the diagnostic plot. `nfun` For `order=1`, the number of functions from `B` whose coordinate-wise univariate depths of functional values should be displayed with the depth of `A`. The depth of `A` is displayed in solid red line, the depths of the functions from `B` in dashed black. `plot` Logical: should the function by plotted?

## Details

Plots a diagnostic plot of pointwise univariate (or bivariate) depths for all possible points (or couples of points) from the domain of the functional data. From such a plot it is possible to infer into the first order (or second order) properties of a single function x with respect to the given set of functional data. For `order=1`, the integral of the displayed function is the integrated depth of x, the smallest value of the function is the infimal depth of x. For `order=2`, the bivariate integral of the displayed surface gives the second order extended integrated depth of x, the infimum of this bivariate function gives the second order infimal depth of x. For details see Nagy et al. (2016) and `depthf.fd1`.

## Value

For `order=1` two depth values, and two vectors of pointwise depths:

• `Simpl_FD` the first order integrated depth based on the simplicial depth,

• `Half_FD` the first order integrated depth based on the halfspace depth,

• `Simpl_ID` the first order infimal depth based on the simplicial depth,

• `Half_ID` the first order infimal depth based on the halfspace depth,

• `PSD` the vector of length `d` containing the computed pointwise univariate simplicial depths used for the computation of `Simpl_FD` and `Simpl_ID`,

• `PHD` the vector of length `d` containing the computed pointwise univariate halfspace depths used for the computation of `Half_FD` and `Half_ID`.

In addition, the first order integrated / infimal depth diagnostic plot of the function `A` with respect to the random sample given by the functions corresponding to the rows of the matrix `B` is produced.

For `order=2` four depth values, and two matrices of pointwise depths:

• `Simpl_FD` the second order integrated depth based on the simplicial depth,

• `Half_FD` the second order integrated depth based on the halfspace depth,

• `Simpl_ID` the second order infimal depth based on the simplicial depth,

• `Half_ID` the second order infimal depth based on the halfspace depth,

• `PSD` the matrix of size `d*d` containing the computed pointwise bivariate simplicial depths used for the computation of `Simpl_FD` and `Simpl_ID`,

• `PHD` the matrix of size `d*d` containing the computed pointwise bivariate halfspace depths used for the computation of `Half_FD` and `Half_ID`.

In addition, the second order integrated / infimal depth diagnostic plot of the function `A` with respect to the random sample given by the functions corresponding to the rows of the matrix `B` is produced.

## Author(s)

Stanislav Nagy, nagy at karlin.mff.cuni.cz

## References

Nagy, S., Gijbels, I. and Hlubinka, D. (2017). Depth-based recognition of shape outlying functions. Journal of Computational and Graphical Statistics, 26 (4), 883–893.

`depthf.fd1`
 ```1 2 3 4``` ```datafA = dataf.population()\$dataf dataf = dataf.population()\$dataf[2:20] shape.fd.analysis(datafA,dataf,order=1) shape.fd.analysis(datafA,dataf,order=2,approx=0) ```