sub-.mfData: Operator 'sub-.mfData' to subset 'mfData' objects

Description Usage Arguments Value See Also Examples

Description

This method provides an easy and natural way to subset a multivariate functional dataset stored in a mfData object, without having to deal with the inner representation of mfData class.

Usage

1
2
## S3 method for class 'mfData'
mfD[i, j]

Arguments

mfD

the multivariate functional dataset in form of mfData object.

i

a valid expression to subset rows ( observations ) of the univariate functional dataset.

j

a valid expression to subset columns ( measurements over the grid ) of the univariate functional dataset (must be contiguous).

Value

The method returns and mfData object containing the required subset ( both in terms of observations and measurement points ) of the multivariate functional dataset.

See Also

mfData

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# Defining parameters
N = 1e2

P = 1e3

t0 = 0
t1 = 1

# Defining the measurement grid
grid = seq( t0, t1, length.out = P )

# Generating an exponential covariance matrix to be used in the simulation of
# the functional datasets (see the related help for details)
C = exp_cov_function( grid, alpha = 0.3, beta = 0.4 )

# Simulating the measurements of two univariate functional datasets with
# required center and covariance function
Data_1 = generate_gauss_fdata( N, centerline = sin( 2 * pi * grid ), Cov = C )
Data_2 = generate_gauss_fdata( N, centerline = sin( 2 * pi * grid ), Cov = C )

# Building the mfData object
mfD = mfData( grid, list( Data_1, Data_2 ) )

# Subsetting the first 10 elements and 10 time points
mfD[1:10, 1:10]

# Subsetting only observations
mfD[1:10,]

# Subsetting only time points (contiguously)
mfD[,1:10]

roahd documentation built on Nov. 4, 2021, 1:07 a.m.