make_synthetic: Creates a synthetic time series by adding white Gaussian...

Description Usage Arguments Details Value

Description

This function works as follows: The price returns are computed. Then a rolling standard deviation of these returns is calculated for each price series in the matrix. An SMA is then applied to stabilize the SD values. The resulting varying SD matrix is then used to compute the additive noise matrix, where the varying SD matrix is used to generated normal noise of SD = that matrix. Last, this normal noise matrix is multiplied by the noise gain and added to the returns, to create a synthetic series with Additive White Gaussian Noise (AWGN).

Usage

1
2
make_synthetic(prices, noisegain = 0.5, sdwindow = 21,
  smawindow = 10, N = 1, by_symbol = TRUE)

Arguments

prices

An xts series of prices. May contain multiple columns. The synthetic series returned will have the same structure, so AWGN (Additive White Gaussian Noise) will be added to each series on a per item basis.

noisegain

This is the amount of fixed gain, expressed as a multiplier to the standard deviation, to add to each value.

sdwindow

The time window to compute the rolling standard deviation from the prices.

smawindow

The time window to compute the rolling SMA from the rolling standard deviation matrix. This essentially smooths out the sd matrix.

N

The number of independent synthetic series to create.

by_symbol

If FALSE, then the list returned is of length N, and the underlying xts contain one instance of each synthesized symbol.

If TRUE, then the list returns is organized by symbols and the underlying xts contain all synthesized instances of the said symbol.

Details

The objective is to add noise of the same amplitude as the current standard deviation of the underlying price series, so as to always inject a similar percentage of noise to the series.

This function can generate multiple independent synthetic series.

Value

If the number of columns provided in the prices matrix is 1, then an xts is returned with N independent time series. Argument by_symbol is ignored.

If the number of colums provided in the prices matrix is > 1, then a LIST of xts is returned. If by_symbol = TRUE, then each element in the list will correspond to a symbol, and each xts under that symbol will contain N synthetic series. If by_symbol = FALSE, then each list element contains an instance of synthetic series, and each xts contains one instance of synthetic prices for each price column provided.


jeanmarcgp/xtsanalytics documentation built on May 19, 2019, 12:38 a.m.