R/correlation.R
area_ordered.Rd
This function implements an order relation between univariate functional data based on the area-under-curve relation, that is to say a pre-order relation obtained by comparing the area-under-curve of two different functional data.
area_ordered(fData, gData)
the first univariate functional dataset containing elements to
be compared, in form of fData
object.
the second univariate functional dataset containing elements to
be compared , in form of fData
object.
The function returns a logical vector of length \(\max(N,M)\)containing the value of the predicate for all the corresponding elements.
Given a univariate functional dataset, \(X_1(t), X_2(t), \ldots, X_N(t)\) and another functional dataset \(Y_1(t),\) \(Y_2(t), \ldots, Y_M(t)\) defined over the same compact interval \(I=[a,b]\), the function computes the area-under-curve (namely, the integral) in both the datasets, and checks whether the first ones are lower or equal than the second ones.
By default the function tries to compare each \(X_i(t)\) with the corresponding \(Y_i(t)\), thus assuming \(N=M\), but when either \(N=1\) or \(M=1\), the comparison is carried out cycling over the dataset with fewer elements. In all the other cases (\(N\neq M,\) and either \(N \neq 1\) or \(M \neq 1\)) the function stops.
Valencia, D., Romo, J. and Lillo, R. (2015). A Kendall correlation
coefficient for functional dependence, Universidad Carlos III de Madrid
technical report,
http://EconPapers.repec.org/RePEc:cte:wsrepe:ws133228
.
P = 1e3
grid = seq( 0, 1, length.out = P )
Data_1 = matrix( c( 1 * grid,
2 * grid ),
nrow = 2, ncol = P, byrow = TRUE )
Data_2 = matrix( 3 * ( 0.5 - abs( grid - 0.5 ) ),
nrow = 1, byrow = TRUE )
Data_3 = rbind( Data_1, Data_1 )
fD_1 = fData( grid, Data_1 )
fD_2 = fData( grid, Data_2 )
fD_3 = fData( grid, Data_3 )
area_ordered( fD_1, fD_2 )
#> [1] TRUE FALSE
area_ordered( fD_2, fD_3 )
#> [1] FALSE TRUE FALSE TRUE