Synthetic time series

For time series the order of the observations carries information: a synthetic series should reproduce the marginal distribution and the autocorrelation (and, for several series, the cross-correlation). fit_synthesizer() has a method for ts objects with four generators.

library(SynthesizerPlus)
method What it preserves How
"copula_var" (default) marginals, auto- and cross-correlation VAR on normal scores, bootstrapped innovations
"block" short-range dependence, exact values moving (circular) block bootstrap
"stationary" short-range dependence, exact values stationary bootstrap (Politis & Romano, 1994)
"iid" marginals and contemporaneous correlation only cross-sectional copula

Copula-VAR

Each series is transformed to normal scores through its empirical distribution, a vector autoregression is fitted (order chosen by AIC up to max_lag), new paths are simulated with innovations resampled from the fitted residuals, and the paths are mapped back through the empirical quantile functions.

fit <- fit_synthesizer(ldeaths)
fit
#> <sp_ts_synthesizer>
#>   trained on : 72 time points, 1 series (frequency 12)
#>   method     : copula_var (VAR order 5)
syn <- generate(fit, seed = 1)
plot_ts(ldeaths, syn)

plot_acf(ldeaths, syn, lag_max = 24)

Synthetic series can be of any length and start anywhere:

long <- generate(fit, n = 240, start = c(1980, 1), seed = 2)
tsp(long)
#> [1] 1980.000 1999.917   12.000

Several series

returns <- diff(log(EuStockMarkets))
fit_mv <- fit_synthesizer(returns)
syn_mv <- generate(fit_mv, seed = 1)
round(cor(returns) - cor(syn_mv), 3)
#>         DAX    SMI    CAC   FTSE
#> DAX   0.000  0.008  0.000 -0.028
#> SMI   0.008  0.000 -0.007 -0.012
#> CAC   0.000 -0.007  0.000 -0.022
#> FTSE -0.028 -0.012 -0.022  0.000

Bootstraps

Block bootstraps resample stretches of the observed series, so they keep short-range dependence and the exact values (and non-linear features within blocks), at the price of repeating observed values:

fit_b <- fit_synthesizer(lh, method = "stationary", block_length = 8)
syn_b <- generate(fit_b, n = 96, seed = 1)
plot_ts(lh, syn_b)

Practical notes

References

Politis, D. N. and Romano, J. P. (1994). The stationary bootstrap. Journal of the American Statistical Association, 89(428), 1303–1313.