This function implements a constructor for elements of S3 class fData, aimed at implementing a representation of a functional dataset.

fData(grid, values)



the evenly spaced grid over which the functional observations are measured. It must be a numeric vector of length P.


the values of the observations in the functional dataset, provided in form of a 2D data structure (e.g. matrix or array) having as rows the observations and as columns their measurements over the 1D grid of length P specified in grid.


The function returns a S3 object of class fData, containing the following elements:

  • "N": the number of elements in the dataset;

  • "P": the number of points in the 1D grid over which elements are measured;

  • "t0": the starting point of the 1D grid;

  • "tP": the ending point of the 1D grid;

  • "values": the matrix of measurements of the functional observations on the 1D grid provided with grid.


The functional dataset is represented as a collection of measurement of the observations on an evenly spaced, 1D grid of discrete points (representing, e.g. time), namely, for functional data defined over a grid \([t_0, t_1, \ldots, t_{P-1}]\):

$$ f_{i,j} = f_i( t_0 + j h ), \quad h = \frac{t_P - t_0}{N}, \quad \forall j = 1, \ldots, P, \quad \forall i = 1, \ldots N.$$


# Defining parameters
N = 20
P = 1e2

# One dimensional grid
grid = seq( 0, 1, length.out = P )

# Generating an exponential covariance function (see related help for more
# information )
C = exp_cov_function( grid, alpha = 0.3, beta = 0.4 )

# Generating a synthetic dataset with a gaussian distribution and
# required mean and covariance function:
values = generate_gauss_fdata( N,
                               centerline = sin( 2 * pi * grid ),
                               Cov = C )

fD = fData( grid, values )