fdistmatrix {puls}R Documentation

Distance Between Functional Objects

Description

Calculate the distance between functional objects over the defined range.

Usage

fdistmatrix(fd, subrange, distmethod)

Arguments

fd

A functional data object fd of fda package.

subrange

A vector of two values indicating the value range of functional object to calculate on.

distmethod

The method for calculating the distance matrix. Choose between "usc" and "manual". "usc" uses fda.usc::metric.lp() function while "manual" uses squared distance between functions. See Details.

Details

If choosing distmethod = "manual", the L2 distance between all pairs of functions y_i(t) and y_j(t) is given by:

d_R(y_i, y_j) = \sqrt{\int_{a_r}^{b_r} [y_i(t) - y_j(t)]^2 dt}.

Value

A distance matrix with diagonal value and the upper half.

Examples

library(fda)
# Examples taken from fda::Data2fd()
data(gait)
# Function only works on two dimensional data
gait <- gait[, 1:5, 1]
gaitbasis3 <- create.fourier.basis(nbasis = 5)
gaitfd3 <- Data2fd(gait, basisobj = gaitbasis3)

fdistmatrix(gaitfd3, c(0.2, 0.4), "usc")

[Package puls version 0.1.2 Index]