depth.fdata {fda.usc} | R Documentation |
Computation of depth measures for functional data
Description
Several depth measures can be computed for functional data for descriptive or classification purposes.
Usage
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 = "vexponential",
dfunc = "TD1",
par.dfunc = list(),
scale = FALSE,
draw = FALSE,
...
)
depth.RPD(
fdataobj,
fdataori = fdataobj,
nproj = 20,
proj = 1,
deriv = c(0, 1),
trim = 0.25,
dfunc2 = mdepth.LD,
method = "fmm",
draw = FALSE,
...
)
depth.RT(
fdataobj,
fdataori = fdataobj,
trim = 0.25,
nproj = 10,
proj = 1,
xeps = 1e-07,
draw = FALSE,
...
)
depth.KFSD(
fdataobj,
fdataori = fdataobj,
trim = 0.25,
h = NULL,
scale = FALSE,
draw = FALSE
)
depth.FSD(
fdataobj,
fdataori = fdataobj,
trim = 0.25,
scale = FALSE,
draw = FALSE
)
depth.FM(
fdataobj,
fdataori = fdataobj,
trim = 0.25,
scale = FALSE,
dfunc = "FM1",
par.dfunc = list(scale = TRUE),
draw = FALSE
)
Arguments
fdataobj |
The set of new curves to evaluate the depth.
|
fdataori |
The set of reference curves respect to which the depth is
computed. |
trim |
The alpha of the trimming. |
metric |
Metric function, by default |
h |
Bandwidth, |
scale |
=TRUE, the depth is scaled respect to depths in
|
draw |
=TRUE, draw the curves, the sample median and trimmed mean. |
... |
Further arguments passed to or from other methods. For
|
nproj |
The number of projections. Ignored if a |
proj |
if a |
dfunc |
type of univariate depth function used inside depth function:
"FM1" refers to the original Fraiman and Muniz univariate depth (default),
"TD1" Tukey (Halfspace),"Liu1" for simplical depth, "LD1" for Likelihood
depth and "MhD1" for Mahalanobis 1D depth. Also, any user function
fulfilling the following pattern |
par.dfunc |
List of parameters for dfunc. |
deriv |
Number of derivatives described in integer vector |
dfunc2 |
Multivariate depth function (second step depth function) in
RPD depth, by default |
method |
Type of derivative method. See
|
xeps |
Accuracy. The left limit of the empirical distribution function. |
Details
Type of depth functions: Fraiman and Muniz (FM) depth, modal depth, random Tukey (RT), random projection (RP) depth and double random projection depth (RPD).
-
depth.FM
: computes the integration of an univariate depth along the axis x (see Fraiman and Muniz 2001). It is also known as Integrated Depth. -
depth.mode
: implements the modal depth (see Cuevas et al 2007). -
depth.RT
: implements the Random Tukey depth (see Cuesta–Albertos and Nieto–Reyes 2008). -
depth.RP
: computes the Random Projection depth (see Cuevas et al. 2007). -
depth.RPD
: implements a depth measure based on random projections possibly using several derivatives (see Cuevas et al. 2007). -
depth.FSD
: computes the Functional Spatial Depth (see Sguera et al. 2014). -
depth.KFSD
: implements the Kernelized Functional Spatial Depth (see Sguera et al. 2014).
-
depth.mode
: calculates the depth of a datum accounting the number of curves in its neighbourhood. By default, the distance is calculated usingmetric.lp
function although any other distance could be employed through argumentmetric
(with the general patternUSER.DIST(fdataobj,fdataori)
). -
depth.RP
: summarizes the random projections through averages whereas thedepth.RT
function uses the minimum of all projections. -
depth.RPD
: involves the original trajectories and the derivatives of each curve in two steps. It builds random projections for the function and their derivatives (indicated in the parameterderiv
) and then applies a depth function (by defaultdepth.mode
) to this set of random projections (by default the Tukey one). -
depth.FSD
anddepth.KFSD
: are the implementations of the default versions of the functional spatial depths proposed in Sguera et al 2014. At this moment, it is not possible to change the kernel in the second one.
Value
Return a list with:
-
median
: Deepest curve. -
lmed
: Index deepest elementmedian
. -
mtrim
:fdata
class object with the average from the(1-trim)%
deepest curves. -
ltrim
: Indexes of curves that conform the trimmed meanmtrim
. -
dep
: Depth of each curve of fdataobj w.r.t. fdataori. -
dep.ori
: Depth of each curve of fdataori w.r.t. fdataori. -
proj
: The projection value of each point on the curves. -
dist
: Distance matrix between curves or functional data.
Author(s)
Manuel Febrero-Bande, Manuel Oviedo de la Fuente manuel.oviedo@udc.es
References
Cuevas, A., Febrero-Bande, M., Fraiman, R. (2007). Robust estimation and classification for functional data via projection-based depth notions. Computational Statistics 22, 3, 481-496.
Fraiman R, Muniz G. (2001). Trimmed means for functional data. Test 10: 419-440.
Cuesta–Albertos, JA, Nieto–Reyes, A. (2008) The Random Tukey Depth. Computational Statistics and Data Analysis 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. https://www.jstatsoft.org/v51/i04/
Sguera C, Galeano P, Lillo R (2014). Spatial depth based classification for functional data. TEST 23(4):725–750.
See Also
See Also as Descriptive
.
Examples
## Not run:
#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)
out.FSD=depth.FSD(fdataobj,trim=0.1,draw=TRUE)
out.KFSD=depth.KFSD(fdataobj,trim=0.1,draw=TRUE)
## Double Random Projections
out.RPD=depth.RPD(fdataobj,deriv=c(0,1),dfunc2=mdepth.LD,
trim=0.1,draw=TRUE)
out<-c(out.FM$mtrim,out.mode$mtrim,out.RP$mtrim,out.RPD$mtrim)
plot(fdataobj,col="grey")
lines(out)
cdep<-cbind(out.FM$dep,out.mode$dep,out.RP$dep,out.RT$dep,out.FSD$dep,out.KFSD$dep)
colnames(cdep)<-c("FM","mode","RP","RT","FSD","KFSD")
pairs(cdep)
round(cor(cdep),2)
## End(Not run)