Description Usage Arguments Value References See Also Examples
View source: R/spec_density_simulate.R
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
).
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
)
|
spec_density |
The spectral density operator defined as an integral operator through with the given kernel. Function of three variables, |
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 |
include_freq_zero |
If set |
functional time series sample, matrix of size (n_grid
,t_max
)
Rubin, Panaretos. Simulation of stationary functional time series with given spectral density. arXiv, 2020
spec_density_covlagh_operator
, CKL_simulate
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' )
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.