makeNoise: Create a set of returns in xts format that follow a specified...

Description Usage Arguments Value Examples

View source: R/makeNoise.R

Description

This function returns a set of returns that follow the distribution passed to makeNoise by the user. It is a convenience function when you want a set of random returns that follow a certain distribution. The function is a wrapper for rnorm etc. that handles all the time series wrangling.

Usage

1
2
makeNoise(num_assets = 1, num_returns = 60, dates = NULL,
  dist = "rnorm", ...)

Arguments

num_assets

the number of columns of length n to create.

num_returns

the number of rows you would like returned.

dates

the dates you would like to use for the returns. If NULL, the function will use SysDate() and go back in time n days.

dist

one of "rnorm", "runif", or "dt".

...

other pass-through parameters to the random number generators.

Value

a set of returns in xts format following the desired distribution.

Examples

1
2
3
4
5
# Make 5 normally distributed assets...
makeNoise(5)

# Make 5 normally distributed assets, 10 returns each, with sd = .10/sqrt(252), mean = 0)
makeNoise(5, num_returns = 10, mean = 0, sd = .10/sqrt(252))

gtog/dMisc documentation built on May 17, 2019, 8:57 a.m.