Learn R Programming

CepReg (version 0.1.3)

data_generater: Generate Time Series

Description

Simulates real-valued time series using the Cramér spectral representation and inverse FFT.

Usage

data_generater(N, nobs, spec)

Value

Matrix of size nobs × N of generated time series

Arguments

N

Number of time series to generate.

nobs

Number of time points.

spec

Spetral density matrix.

Examples

Run this code
set.seed(123)
N    <- 3
nobs <- 20
freqs <- (1:nobs) / nobs

spec <- matrix(NA, nrow = nobs, ncol = N)
for (i in 1:N) {
  spec[, i] <- exp(2 * cos(2 * pi * freqs) + rnorm(1, sd = 0.1))
}

data_generater(N = N, nobs = nobs, spec = spec)

Run the code above in your browser using DataLab