median_fData: Median of a univariate functional dataset

Description Usage Arguments Details Value See Also Examples

View source: R/fData.R

Description

This method computes the sample median of a univariate functional dataset based on a definition of depth for univariate functional data.

Usage

1

Arguments

fData

the univariate functional dataset whose median is required, in form of fData object.

type

a string specifying the name of the function defining the depth for univariate data to be used. It must be a valid name of a function defined in the current environment, default is MBD.

...

additional parameters to be used in the function specified by argument type.

Details

Provided a definition of functional depth for univariate data, the corresponding median (i.e. the deepest element of the sample) is returned as the desired median. This method does not coincide with the computation of the cross-sectional median of the sample of the point-by-point measurements on the grid. Hence, the sample median is a member of the dataset provided.

Value

The function returns a fData object containing the desired sample median.

See Also

fData, mean.fData, median_mfData

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
N = 1e2
P = 1e2
grid = seq( 0, 1, length.out = P )

# Generating a gaussian functional sample with desired mean
# Being the distribution symmetric, the sample mean and median are coincident
target_median = sin( 2 * pi * grid )
C = exp_cov_function( grid, alpha = 0.2, beta = 0.2 )
fD = fData( grid, generate_gauss_fdata( N,
                                      centerline = target_median,
                                       Cov = C ) )

# Graphical representation of the mean
plot( fD )
plot( median_fData( fD ), col = 'black', lwd = 2, lty = 2, add = TRUE )

ntarabelloni/roahd documentation built on Feb. 10, 2022, 1:41 a.m.