spec_density_simulate: Simulate a FTS given by its spectral density operator

Description Usage Arguments Value References See Also Examples

View source: R/spec_density_simulate.R

Description

Simulate functional time series sample defined through their spectral density. The simulation routine needs to perform the SVD decomposition at each freaquency, therefore the simulation is quite slow. For a speedy simulation try to define the spectral density operator through its harmonic Karhunen-Loeve expansion (spec_density_simulate), or by the white noise filter approach (spec_density_simulate).

Usage

1
2
3
4
5
6
7
8
spec_density_simulate(
  spec_density,
  t_max,
  n_grid,
  n_pc,
  seed_number = NULL,
  include_freq_zero = F
)

Arguments

spec_density

The spectral density operator defined as an integral operator through with the given kernel. Function of three variables, omega, x, y, that assigns the value of the spectral density kernel at point (x,y) in [0,1]^2 at frequency omega in [0,pi]. 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, e.g. 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

spec_density_covlagh_operator, CKL_simulate

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# Define the spectral density operator as an integral operator with kernel
k_bbridge <- function(x,y) { pmin(x,y)-x*y }
spec_density <- function( omega, x,y ){ 1/(1-0.9 *cos(omega)) * k_bbridge( (x-omega/pi)%%1, (y-omega/pi)%%1  ) }

# simulation setting
t_max <- 1000 # time horizon to be simulated
n_grid <- 101 # spatial resolution for visualisation on discretisation of [0,1]. warning: scales badly with high "n_grid"
n_pc <- n_grid # number of numerically calculated eigenvalues to use. there is negligible computational gain, thus "n_pc = n_grid" is recommended

# simulate a sample 
fts_x <- spec_density_simulate(spec_density, 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.