Learn R Programming

fda.usc (version 1.1.0)

Depth Functional: Provides the depth measure for functional data

Description

Compute measure of centrality of the functional data. Type of depth function: Fraiman and Muniz (FM) depth, modal depth, random project depth and double random project depth.
  • Thedepth.FMfunction is based on integrated an univariate depth measure along the axis x.
  • Thedepth.modefunction implements the modal depth that selects the curve most densely surrounded by others as the deepest one. By default, the distance is calculated usingmetric.lpfunction.
  • Thedepth.RPfunction implements a depth measure based on random projections.
  • Thedepth.RPDfunction implements a depth measure based on random projections and using several derivatives.
  • Thedepth.RTfunction implements a depth measure based on random projections using a half-space Tukey method.

Usage

depth.FM(fdataobj,fdataori=fdataobj,trim=0.25,xeps=0.00000001,draw=FALSE,...)

depth.mode(fdataobj,fdataori=fdataobj,trim=0.25,
metric=metric.lp,h=NULL,scale=FALSE,draw=FALSE,...)

depth.RP(fdataobj,fdataori=fdataobj,trim=0.25,nproj=50,proj=1,
xeps=0.0000001,draw=FALSE,...)

depth.RPD(fdataobj,fdataori=fdataobj,nproj=50,proj=1,deriv=c(0,1),trim=0.25,
dfunc2=depth.mode,method="fmm",draw=FALSE,...)

depth.RT(fdataobj, fdataori = fdataobj, trim = 0.25, nproj = 10, 
    proj = 1, xeps = 1e-07, draw = FALSE, ...)

Arguments

fdataobj
A set of new curves to evaluate the depth. fdata class object.
fdataori
A set of original curves where the depth is computed. fdata class object.
trim
The alpha of the trimming.
nproj
The number projection.
proj
if is a character: create the random projection using a covariance matrix by process indicated in the argument (by default, proj=1, sigma=diag(ncol(fdataobj))), else if is a matrix of random projection provided by the user.
dfunc2
by default, depth.mode.
deriv
Number of derivatives described in integer vector deriv. =0 means no derivative.
method
Type of derivative method. See fdata.deriv for more details.
h
Bandwidth, h>0.
metric
Metric function, by default metric.lp.
scale
=TRUE, scale the matrix, see scale.
xeps
Accuracy. The left limit of the empirical distribution function.
draw
=TRUE, draw the curves, the sample median and trimmed mean.
...
Further arguments passed to or from other methods.

Value

  • medianDeepest curve.
  • lmedIndex deepest element median.
  • mtrimfdata class object with the average from the (1-trim)% deepest curves.
  • ltrimIndex of curves with trimmed mean mtrim.
  • depDepth of each curve.
  • depDepth of each curve of fdataobj w.r.t. fdataori.
  • dep.oriDepth of each curve of fdataori w.r.t. fdataori.
  • projThe projection value of each point on the curves.
  • distDistance matrix between curves or functional data.

Details

  • FM depth measures the conditional quantile on all points and then integrated. Thedepth.FMmethod sorts the depths along the axis x, ie, performs a ranking of depths.
  • The modal depthdepth.modefunction calculates the depth of a datum accounting the number of curves in the neighbourhood. The mode of a functional data will be the deepest curve.
  • Thedepth.RPfunction calculates depth using univariate depth tools through random projection method (RP).
  • Thedepth.RPDfunction also involves the derivatives of each curve. This function calculates the depth in two steps. It builds random projections for the funcion and their derivatives (indicated in the parameterderiv) without looking at the functional data. Then it applyes a depth function (by defaultdepth.mode) to the set of random projections created for calculate the functional depth by the Tukey method.
  • Thedepth.RTfunction builds random projections and calculates the functional depth by the Tukey method combining the information of all projections.

References

Cuevas, A., Febrero-Bande, M. and Fraiman, R. (2007). Robust estimation and classification for functional data via projection-based depth notions. Computational Statistics 22, 3, 481{-}496. Febrero-Bande, M., Galeano, P., and Gonzalez-Manteiga, W. (2008). Outlier detection in functional data by depth measures with application to identify abnormal NOx levels. Environmetrics 19, 4, 331{-}345. Fraiman R, Muniz G. 2001. Trimmed means for functional data. Test 10: 419{-}440. Cuesta Albertos, J. A. and Nieto Reyes, A. The Random Tukey Depth. Computational Statistics and Data Analysis (2008), Vol. 52, Issue 11, 4979{-}4988. Febrero-Bande, M., Oviedo de la Fuente, M. (2012). Statistical Computing in Functional Data Analysis: The R Package fda.usc. Journal of Statistical Software, 51(4), 1-28. http://www.jstatsoft.org/v51/i04/

See Also

See Also as Descriptive.

Examples

Run this code
#Ex: CanadianWeather data
tt=1:365
fdataobj<-fdata(t(CanadianWeather$dailyAv[,,1]),tt)
# Fraiman-Muniz Depth
out.FM=depth.FM(fdataobj,trim=0.1,draw=TRUE)
#Modal Depth
out.mode=depth.mode(fdataobj,trim=0.1,draw=TRUE)
out.RP=depth.RP(fdataobj,trim=0.1,draw=TRUE)
out.RT=depth.RT(fdataobj,trim=0.1,draw=TRUE)
## NOT RUN
## Double Random Projections
# out.RPD=depth.RPD(fdataobj,deriv=c(0,1),dfunc2=depth.FM,trim=0.1,draw=TRUE)
# out<-c(out.FM$mtrim,out.mode$mtrim,out.RP$mtrim,out.RPD$mtrim)
# plot(out)

Run the code above in your browser using DataLab