Learn R Programming

mrfDepth (version 1.0.17)

mfd: Multivariate functional depth for functional data

Description

Computes the multivariate functional depth for multivariate functional data.

Usage

mfd(x, z = NULL, type = "hdepth", alpha = 0, time = NULL, diagnostic = FALSE,
      depthOptions = NULL)

Value

A list with the following components:

MFDdepthX

Vector of length \(n\) containing the MFD depth of every curve from x.

MFDdepthZ

Vector of length \(m\) containing the MFD depth of every curve from z.

weights

Vector of weights according to the input parameter alpha.

crossDepthsX

An \(n\) by \(t\) matrix containing the multivariate depth of each observation of x at each time point.
Only provided if the input parameter diagnostic is set to TRUE.

crossDepthsZ

An \(m\) by \(t\) matrix containing the multivariate depth of each observation of z at each time point.
Only provided if the input parameter diagnostic is set to TRUE.

locOutlX

An \(n\) by \(t\) matrix flagging local outlyingness for x. Only provided if the input parameter diagnostic is set to TRUE.
The \((i,j)\)th element takes value 1 if curve \(x_i\) is outlying at time point \(j\).

locOutlZ

An \(m\) by \(t\) matrix flagging local outlyingness for z. Only provided if the input parameter diagnostic is set to TRUE.
The \((i,j)\)th element takes value 1 if curve \(z_i\) is outlying at time point \(j\).

IndFlagExactFit

Vector containing the indices of the time points for which an exact fit is detected.

IndFlagBag

Vector containing the indices of the time points for which the bagplot could not be computed.

IndFlagIso

Vector containing the indices of the time points for which the cross-sectional \(\alpha\)-depth contours could not be computed.

IndFlagAlpha

Vector containing the indices of the time points for which the volume of the cross-sectional \(\alpha\)-depth contours could not be computed.

Arguments

x

A three-dimensional \(t\) by \(n\) by \(p\) array, with \(t\) the number of observed time points, \(n\) the number of functional observations and \(p\) the number of measurements for every functional observation at every time point.

z

An optional three-dimensional \(t\) by \(m\) by \(p\) array, containing the observations for which to compute the multivariate functional depth with respect to x. If z is not specified, it is set equal to x. The time points of z should correspond to those of x.

type

The depth used in the computations. One of the following options: "hdepth", "projdepth", "sprojdepth", "dprojdepth", "sdepth".
Defaults to "hdepth".

alpha

Specifies the weights at every cross-section. When alpha = 0, uniform weights are used. Weights following equation (2) in Claeskens et al. (2014) are obtained by setting alpha to a number smaller than the maximal depth at any time point. The weights are then proportional to the volume of the \(\alpha\)-depth regions at each cross-section. Otherwise alpha should be a weight vector of length \(t\).
Defaults to 0.

time

If the measurements are not equidistant, a sorted numeric vector containing a set of time points.
Defaults to 1:t.

diagnostic

If set to TRUE, the output contains some additional components:
crossDepths: an \(n\) by \(t\) matrix containing the multivariate depth of each observation at each time point
locOutl: output containing flags for local outlyingness (see "Value" for more details)
Defaults to FALSE.

depthOptions

A list of options to pass to the function computing the cross-sectional depths.
See hdepth, projdepth, sprojdepth, dprojdepth or sdepth.

Author

P. Segaert and M. Hubert

Details

The multivariate functional depth of a multivariate curve with respect to a given set of multivariate curves is defined as the weighted average of its multivariate depth at each time point (Claeskens et al., 2014). The MFD can be computed in all dimensions \(p\) using halfspace depth, projection depth, skewness-adjusted projection depth and directional projection depth. For \(p<=2\) also simplicial depth is available.

When the data array z is specified, the MFD depth and diagnostic information for the data array x is also returned whenever the underlying depth routine allows it. For more information see the specific depth routines listed in the section "See Also".

For the weight vector, three options are available: uniform weights, user-defined weights or weights proportional to the volume of the \(\alpha\)-depth contour at each time point. The \(\alpha\)-depth contours are computed using the depthContour function.

In some situations, additional diagnostics are available to flag outlying time points, as described in Hubert et al. (2012). At each time point, observations from the data array x are marked if they are flagged as outliers. When using any of the projection depth measures, this flag is automatically returned by the corresponding functions. When using halfspace depth, the diagnostic is only available for bivariate curves. The observations from the data array x are marked if they are flagged as outliers by the bagplot, or similarly if their bagdistance is larger than 3 at that time point. This can be seen as a measure of local outlyingness. The option is not available for simplicial depth.

A heatmap of the cross-sectional depth values can be drawn by setting diagnostic to TRUE and passing the results to fHeatmap.

It is possible that at certain time points a part of the algorithm can not be executed due to e.g. exact fits. In that case the weight of that particular time point is set to zero. A warning is issued at the end of the algorithm to signal these time points. Furthermore the output contains an extra argument giving the indices of the time points where problems occured.

References

Claeskens G., Hubert M., Slaets L., Vakili K. (2014). Multivariate functional halfspace depth. Journal of the American Statistical Association, 109, 411--423.

Hubert M., Claeskens G., De Ketelaere B., Vakili K. (2012). A new depth-based approach for detecting outlying curves. In Proceedings of COMPSTAT 2012, edited by A. Colubi, K. Fokianos, G. Gonzalez-Rodriguez, E.J. Kontoghiorghes, 329--340.

See Also

depthContour, hdepth, projdepth, sprojdepth, dprojdepth, sdepth, fHeatmap

Examples

Run this code
data(octane)
Result <- mfd(x = octane, alpha = 0.125, diagnostic = TRUE)

Plot <- fHeatmap(rowValues = Result$MFDdepthZ,
                 cellValues = Result$crossdepthZ,
                 type = "depth",
                 legend.title = "HD")
Plot 

Run the code above in your browser using DataLab