metric.kl {fda.usc} | R Documentation |
Kullback–Leibler distance
Description
Measures the proximity between two groups of densities (of class
fdata
) by computing the Kullback–Leibler distance.
Usage
metric.kl(fdata1, fdata2 = NULL, symm = TRUE, base = exp(1), eps = 1e-10, ...)
Arguments
fdata1 |
Functional data 1 ( |
fdata2 |
Functional data 2 ( |
symm |
If |
base |
The logarithm base used to compute the distance. |
eps |
Tolerance value. |
... |
Further arguments passed to or from other methods. |
Details
Kullback–Leibler distance between and
is
where are the
m
coordinates of the points
where the density is observed (the argvals
of the fdata
object).
The Kullback–Leibler distance is asymmetric,
A symmetry version of K–L distance (by default) can be obtained by
If .
If ,
where
is the tolerance value (by default
eps=1e-10
).
The coordinates of the points where the density is observed (discretization
points ) can be equally spaced (by default) or not.
Author(s)
Manuel Febrero-Bande, Manuel Oviedo de la Fuente manuel.oviedo@udc.es
References
Kullback, S., Leibler, R.A. (1951). On information and sufficiency. Annals of Mathematical Statistics, 22: 79-86
See Also
Examples
## Not run:
n<-201
tt01<-seq(0,1,len=n)
rtt01<-c(0,1)
x1<-dbeta(tt01,20,5)
x2<-dbeta(tt01,21,5)
y1<-dbeta(tt01,5,20)
y2<-dbeta(tt01,5,21)
xy<-fdata(rbind(x1,x2,y1,y2),tt01,rtt01)
plot(xy)
round(metric.kl(xy,xy,eps=1e-5),6)
round(metric.kl(xy,eps=1e-5),6)
round(metric.kl(xy,eps=1e-6),6)
round(metric.kl(xy,xy,symm=FALSE,eps=1e-5),6)
round(metric.kl(xy,symm=FALSE,eps=1e-5),6)
plot(c(fdata(y1[1:101]),fdata(y2[1:101])))
metric.kl(fdata(x1))
metric.kl(fdata(x1),fdata(x2),eps=1e-5,symm=F)
metric.kl(fdata(x1),fdata(x2),eps=1e-6,symm=F)
metric.kl(fdata(y1[1:101]),fdata(y2[1:101]),eps=1e-13,symm=F)
metric.kl(fdata(y1[1:101]),fdata(y2[1:101]),eps=1e-14,symm=F)
## End(Not run)