Learn R Programming

fda.usc (version 0.9.4)

semimetric.NPFDA: Proximities between functional data (semi-metrics)

Description

Aproximates semi-metric distances for functional data by Ferraty F and Vieu, P. (2006) aproach. semimetric.deriv: computes a semi-metric between curves based on their derivatives. semimetric.fourier: computes a semi-metric between curves based on their Fourier expansion. semimetric.hshift: computes between curves a semi-metric taking into account an horizontal shift effect. semimetric.mplsr: computes between curves a semi-metric based on the partial least squares method. semimetric.pca: computes between curves a pca-type semi-metric based on the functional principal components analysis method.

Usage

semimetric.hshift(fdataobj1, fdataobj2, t=1:ncol(DATA1),...)
semimetric.mplsr(fdataobj1, fdataobj2, q=2, class1,...)
semimetric.pca(fdataobj1, fdataobj2, q=1,...)
semimetric.deriv(fdataobj1, fdataobj2, nderiv=1,
nknot=ifelse(floor(ncol(DATA1)/3)>floor((ncol(DATA1)-nderiv-4)/2),
floor((ncol(DATA1)-nderiv-4)/2),floor(ncol(DATA1)/3)),
range.t=c(0,1),...)
semimetric.fourier(fdataobj1, fdataobj2, nderiv=0,
nbasis=ifelse(floor(ncol(DATA1)/3)>floor((ncol(DATA1)-nderiv-4)/2),
floor((ncol(DATA1) - nderiv - 4)/2), floor(ncol(DATA1)/3)),
range.t=c(0,1), period=NULL,...)

Arguments

fdataobj1
Functional data 1 or curve 1. DATA1 with dimension (n1 x m), where n1 is the number of curves and m are the points observed in each curve.
fdataobj2
Functional data 2 or curve 2. DATA1 with dimension (n2 x m), where n2 is the number of curves and m are the points observed in each curve.
q
If semimetric.pca: the retained number of principal components. If semimetric.mplsr: the retained number of factors.
nknot
semimetric.deriv argument: number of interior knots (needed for defining the B-spline basis).
range.t
semimetric.deriv argument: vector of length 2 containing the range of the t at which the curve are evaluated (i.e. range of the discretization).
nderiv
Order of derivation, used in semimetric.deriv and semimetric.fourier
nbasis
semimetric.fourier: size of the basis.
period
semimetric.fourier:allows to select the period for the fourier expansion.
t
semimetric.hshift: vector which defines t (one can choose 1,2,...,nbt where nbt is the number of points of the discretization)
class1
semimetric.mplsr: vector containing a categorical response which corresponds to class number for units stored in DATA1.
...
Further arguments passed to or from other methods.

Value

  • Returns a semimetric.NPFDA matrix containing the semimetric computed between the curves lying to the first sample and the curves lying to the second one.

source

http://www.math.univ-toulouse.fr/staph/npfda/

Details

The following instructions have been used file: http://www.math.univ-toulouse.fr/staph/npfda/

References

Ferraty, F. and Vieu, P. (2006). Nonparametric functional data analysis. Springer Series in Statistics, New York. Ferraty, F. and Vieu, P. (2006). NPFDA in practice. Free access on line at http://www.lsp.ups-tlse.fr/staph/npfda/

See Also

See also metric.lp and semimetric.basis

Examples

Run this code
#	INFERENCE PHONDAT
data(phoneme)
#ind=c(1:50,201:250)
ind<-1:250
mlearn<-phoneme$learn[ind,]
mtest<-phoneme$test[ind,]
n=nrow(mlearn[["data"]])
np=ncol(mlearn[["data"]])
mdist1=semimetric.pca(mlearn,mtest)
mdist2=semimetric.pca(mlearn,mtest,q=2)
mdist3=semimetric.deriv(mlearn,mtest,nderiv=0)
mdist4=semimetric.fourier(mlearn,mtest,nderiv=2,nbasis=21,c(1,np))
#uses hshift function
#mdist5=semimetric.hshift(mlearn,mtest) #takes a lot
#mdist6=semimetric.hshift(mlearn,mtest,1:np) #takes a lot
glearn<-phoneme$classlearn[ind]
#uses mplsr function
mdist7=semimetric.mplsr(mlearn,mtest,5,glearn)
mdist0=metric.lp(mlearn,mtest)

b=as.dist(mdist7)
c2=hclust(b)
plot(c2)
memb <- cutree(c2, k = 2)
table(memb,phoneme$classlearn[ind])

Run the code above in your browser using DataLab