dist_comp | R Documentation |
Compute pairwise distances starting from single objects containing the original univariate observations.
dist_comp(x, lp = 2)
x |
Object containing the original univariate observations. Currently available types and the form they need to have to be correctly recognized are the following:
See Details to find out which distance is used in each case. |
lp |
Integer specifying which norm should be used to compute the distances for functional data. |
The distances used in each case are the following:
Logical: Euclidean distance, implemented via dist()
;
Numeric: Euclidean distance, implemented via dist()
;
Nominal: Gower's distance, implemented via daisy()
;
Functions: L^p-norm, implemented via
metric.lp()
with default options;
Graphs: Edge Difference distance (Hammond et al., 2013), implemented via
nd.edd()
;
Persistence diagrams: Wasserstein distance, implemented via
wasserstein()
with default options;
Object of class "dist"
containing the pairwise distances.
D. K. Hammond, Y. Gur, and C. R. Johnson (2013). Graph diffusion distance: A difference measure for weighted graphs based on the graph laplacian exponential kernel. In 2013 IEEE Global Conference on Signal and Information Processing, pages 419-422.
# Number of observations nobs <- 10 ## Logical obj <- as.logical(rbinom(nobs, 1, 0.5)) d <- dist_comp(obj) ## Integer obj <- rpois(nobs, 5) d <- dist_comp(obj) ## Numeric obj <- rnorm(nobs) d <- dist_comp(obj) ## Factors obj <- factor(letters[1:nobs]) d <- dist_comp(obj) ## Functional data obj <- fda.usc::rproc2fdata(nobs, seq(0, 1, len = 100), sigma = 1) d <- dist_comp(obj) ## Graphs obj <- lapply(1:nobs, function(j) igraph::sample_gnp(100, 0.2)) d <- dist_comp(obj) ## Persistence diagrams x <- lapply(rep(100, nobs), function(np) TDA::circleUnif(np)) obj <- lapply(x, TDA::ripsDiag, maxdimension = 1, maxscale = 3) d <- dist_comp(obj)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.