calculate.fda: Calculation of derivatives using the Functional Data Analysis...

Description Usage Arguments Value Examples

View source: R/doremi.R

Description

calculate.fda estimates the derivatives of a variable using the FDA method described in several sources, such as in doi: 10.1007/b98888Ramsay et al. (2009) and doi: 10.1080/00273171.2015.1123138Chow et al. (2016). This method estimates a spline function that fits all the data points and then derivates this function to estimate derivatives at those points. In order for the derivatives to exist, the function must be smooth. A roughness penalty function controlled by a smoothing parameter is then used. The estimations are done by using the R's base smooth.spline function.

Usage

1
calculate.fda(signal, time, spar = NULL, order = NULL)

Arguments

signal

is a vector containing the data from which the derivative is estimated.

time

is a vector containing the time values corresponding to the signal. Arguments signal and time must have the same length.

spar

is the smoothing parameter used by the roughness penalty function in the smooth.spline R function.

order

parameter not used, for consistency with calculate.glla and calculate.gold

Value

Returns a list containing two elements:

dtime- contains the initial time values provided.

dsignal- is a data.frame containing three columns and the same number of rows as the signal. The first column is the signal data points, the second is the first derivative evaluated at those points, and the third is the second derivative evaluated at those points.

Examples

1
2
3
4
5
6
#In the following example the derivatives for the function y(t) = t^2 are calculated.
#The expected results are:
#y'(t) = 2t and y''(t) = 2
time <- c(1:500)/100
signal <- time^2
result <- calculate.fda(signal = signal, time = time)

doremi documentation built on Jan. 29, 2021, 5:06 p.m.