simXt: Simulate X_t

View source: R/simXt.R

simXtR Documentation

Simulate X_t

Description

Function to simulate X_t. Output is a list object containing the defining parameters. Access the actual time series using $Xt.

Usage

simXt(
  N = 1000,
  numTrend = 0,
  a = NULL,
  mu = NULL,
  center = NULL,
  numFreq = 20,
  bandwidth = NULL,
  b = NULL,
  w = NULL,
  p = 0,
  q = 0,
  snr = 1.5
)

Arguments

N

integer; The desired length of the time series

numTrend

integer; The degree of the polynomial in the mean component; all lower order terms are included

a

numeric; If specified, a vector of custom coefficients for each term in the polynomial mean component

mu

numeric; If specified, a single value representing the grand mean of the polynomial mean component

center

numeric; If specified, a vector of custom centering parameters for each term in the polynomial mean component

numFreq

integer; The number of sinusoids to generate in the trend component

bandwidth

integer; This value is plugged into a negative exponent (base 10) and defines some interval in which to sample frequencies for the trend component. If specified, 'bandwidth' must be at least *-log10(1/*numFreq*)*. If unspecified, frequencies are distributed *~Uniform(a=0,b=1)*

b

numeric; If specified, a vector of custom coefficients on each sinusoid in the trend component

w

numeric; If specified, a vector of custom periods for each sinusoid in the trend component

p

integer; The AR order of the noise component

snr

numeric; The desired signal-to-noise ratio

Examples

# Define four different time series

simData_1 <- simXt(N = 1000, numTrend = 2, numFreq = 10, bandwidth = 2, snr = 1.5)
simData_2 <- simXt(N = 1000, numTrend = 4, numFreq = 30, bandwidth = 1, snr = 3)
simData_3 <- simXt(N = 1000, numTrend = 3, a = c(1/3, 2/3, 5/3), mu = 5, numFreq = 20, snr = 0.7)
simData_4 <- simXt(N = 1000, numTrend = 6, numFreq = 40, p = 1, q = 2)                 
                 
# Creating list object containing the time series themselves in preparation for simulateGaps()

 OriginalData = list(D1 = simData_1$Xt,
                     D2 = simData_2$Xt,
                     D3 = simData_3$Xt,
                     D4 = simData_4$Xt)


castels/interpTools documentation built on June 7, 2024, 4:20 p.m.