fdistmatrix: Distance Between Functional Objects

Description Usage Arguments Details Value Examples

View source: R/fdistmatrix.R

Description

Calculate the distance between functional objects over the defined range.

Usage

1
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) = √{\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

1
2
3
4
5
6
7
8
9
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")

puls documentation built on Feb. 16, 2021, 5:07 p.m.