CKL_simulate: Simulate FTS given its harmonic KL decomposition

Description Usage Arguments Value References See Also Examples

View source: R/CKL_simulate.R

Description

Simulate functional time series sample given its harmonic Karhunen-Loeve decomposition.

Usage

1
2
3
4
5
6
7
8
9
CKL_simulate(
  harmonic_eigenvalues,
  harmonic_eigenfunctions,
  t_max,
  n_grid,
  n_pc,
  seed_number = NULL,
  include_freq_zero = F
)

Arguments

harmonic_eigenvalues

function of two variables, omega and n, that assigns the n-th harmonic eigenvalue at frequency omega. Must be well defined for frequencies (0,pi]. The interval [pi,2pi) is not used and is calculated by mirroring of (0,pi]..

harmonic_eigenfunctions

function of three variables, omega, n and x, that assigns the n-th harmonic eigenfunction at point x in [0,1] at frequency omega. Must be well defined for frequencies (0,pi]. The interval [pi,2pi) is not used and is calculated by mirroring of (0,pi].

t_max

Time horizon to be simulated. Must be an even number, otherwise it is increased by one.

n_grid

Number of grid points (spatial resolution) of the discretisation of [0,1] where the FTS is to be simulated.

n_pc

The number of harmonic eigenfunctions to be used for the simulation at each frequency.

seed_number

The random seed inicialization for the simulation. The value "NULL" means no inicialization

include_freq_zero

If set TRUE, the zero frequency is included for simulation in the spectral domain. Set FALSE for processes with singularity at frequency zero, such as the long-range dependent FARFIMA(p,d,q) process.

Value

functional time series sample, matrix of size (n_grid,t_max)

References

Rubin, Panaretos. Simulation of stationary functional time series with given spectral density. arXiv, 2020

See Also

CKL_covlagh_operator, spec_density_simulate

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# Define the eigenvalues and eigenfunction of the process to simulate
harmonic_eigenvalues <- function( omega, n ){ 1/( (1-0.9 *cos(omega)) * (n*pi)^2 ) }
harmonic_eigenfunctions <- function(omega, n, x){ sqrt(2)*sin( n*(pi*x-omega)  ) }

# simulation setting
t_max <- 1000
n_grid <- 101
n_pc <- 100

# simulate trajectory
fts_x <- CKL_simulate(harmonic_eigenvalues, harmonic_eigenfunctions, t_max, n_grid, n_pc)

# display the first curve
plot( fts_x[,1], type='l' )

tomasrubin/specsimfts documentation built on March 26, 2021, 1:37 p.m.