generate_gauss_fdata generates a dataset of univariate functional data
with a desired mean and covariance function.
generate_gauss_fdata(N, centerline, Cov = NULL, CholCov = NULL)the number of distinct functional observations to generate.
the centerline of the distribution, represented as a one- dimensional data structure of length \(P\) containing the measurement of the centerline on grid points.
the covariance operator (provided in form of a \(P \times P\) matrix) that has to be used in the generation of \(\epsilon(t)\). At
least one argument between Cov and CholCov should be different
from NULL.
the Cholesky factor of the covariance operator (provided in
form of a \(P \times P\) matrix) that has to be used in the
generation of observations from the process \(\epsilon(t)\). At least one
argument between Cov and CholCov should be different from
NULL.
The function returns a matrix containing the discretized values of the generated observations (in form of an \(N \times P\)matrix).
In particular, the following model is considered for the generation of data:
$$X(t) = m( t ) + \epsilon( t ), \quad t \in I = [a, b]$$
where \(m(t)\) is the center and \(\epsilon(t)\) is a centered gaussian process with covariance function \(C_i\). That is to say:
$$Cov( \epsilon(s), \epsilon(t) ) = C( s, t ), \quad \forall s, t \in I$$
All the functions are supposed to be observed on an evenly-spaced, one- dimensional grid of P points: \([a = t_0, t_1, \ldots, t_{P-1} = b] \subset I \).
N = 30
P = 1e2
t0 = 0
tP = 1
time_grid = seq( t0, tP, length.out = P )
C = exp_cov_function( time_grid, alpha = 0.1, beta = 0.2 )
CholC = chol( C )
centerline = sin( 2 * pi * time_grid )
invisible(generate_gauss_fdata( N, centerline, Cov = C ))
invisible(generate_gauss_fdata( N, centerline, CholCov = CholC ))