Several depth measures can be computed for functional data for descriptive or classification purposes. 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.FM(fdataobj,fdataori=fdataobj,trim=0.25,scale=FALSE,
dfunc="FM1",par.dfunc = list(scale = TRUE), draw = FALSE)depth.mode(fdataobj,fdataori=fdataobj,trim=0.25,
metric=metric.lp,h=NULL,scale=FALSE,draw=FALSE,...)
depth.RT(fdataobj,fdataori=fdataobj, trim = 0.25, nproj = 10,
proj = 1, xeps = 1e-07, 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.FSD(fdataobj, fdataori = fdataobj,
trim = 0.25, scale = FALSE, draw = FALSE)
depth.KFSD(fdataobj, fdataori = fdataobj, trim = 0.25,
h=NULL,scale = FALSE, draw = FALSE)
The set of new curves to evaluate the depth. fdata
class object.
The set of reference curves respect to which the depth is computed. fdata
class object.
The alpha of the trimming.
The number of projections. Ignored if a fdata
class object is provided in proj
if a fdata
class, projections provided by the user. Otherwise, it is the sigma
parameter of rproc2fdata
function.
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 FUN.USER(x,xx,...)
and returning a dep
component can be included.
List of parameters for dfunc.
Multivariate depth function (second step depth function) in RPD depth, by default mdepth.LD
. Any user function with the pattern FUN.USER(x,xx,...)
can be employed.
Number of derivatives described in integer vector deriv
. =0
means no derivative.
Type of derivative method. See fdata.deriv
for more details.
Bandwidth parameter.
If h
is a numerical value, the procedure considers the argument value as the bandwidth.
If is NULL
(by default) the bandwidth is provided as the 15%--quantile of the distance among curves of fdataori
.
If h
is a character string (like "0.15"
), the procedure reads the numeric value and consider it as the quantile of the distance in fdataori
(as in the second case).
Metric function, by default metric.lp
. Distance matrix between fdataobj
and fdataori
.
=TRUE, the depth is scaled respect to depths in fdataori
.
Accuracy. The left limit of the empirical distribution function.
=TRUE, draw the curves, the sample median and trimmed mean.
Further arguments passed to or from other methods. For depth.mode
parameters for metric
. For random projection depths, parameters to be included in rproc2fdata
not included before.
Deepest curve.
Index deepest element median
.
fdata
class object with the average from the (1-trim)%
deepest curves.
Indexes of curves that conform the trimmed mean mtrim
.
Depth of each curve of fdataobj w.r.t. fdataori.
Depth of each curve of fdataori w.r.t. fdataori.
The projection value of each point on the curves.
Distance matrix between curves or functional data.
The depth.mode
function calculates the depth of a datum accounting the number of curves in its neighbourhood. By default, the distance is calculated using metric.lp
function although any other distance could be employed through argument metric
(with the general pattern USER.DIST(fdataobj,fdataori)
).
The depth.RP
function summarizes the random projections through averages whereas the depth.RT
function uses the minimum of all projections.
The depth.RPD
function 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 parameter deriv
) and then applies a depth function (by default depth.mode
) to this set of random projections (by default the Tukey one).
The depth.FSD
and depth.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.
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. http://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 as Descriptive
.
# 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=depth.FM,
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)
# }
Run the code above in your browser using DataCamp Workspace