Useful for development or generating easily reproducible examples
generate_random_ts(
n = 1,
lengths = 36,
starts = 1988,
frequencies = 12,
ranges_min = -1,
ranges_max = 1,
shifts = 0,
ts_names = sprintf("ts%d", 1:n),
seed = 30042018,
random_NAs = FALSE,
random_NA_proportions = 0.1,
normally_distributed = FALSE,
normal_means = 0,
normal_sds = 1,
frequency_shifts = FALSE,
frequency_shift_after = 0.5
)
A list of ts objects
The number of ts objects to generate
The lengths of the time series
The start points of the time series in single number notation (e.g. 1990.5)
The frequencies of the time series
The minimum values of the time series (if normally_distributed == FALSE)
The maximum values of the time series (if normally_distributed == FALSE)
The shifts of time series values per series
The names of the ts objects in the resulting list
The random seed to be used
Whether or not to introcude NA values at random positions in the ts
The fraction of values to be replaced with NAs if random_NAs is TRUE for the series
Use normal distribution instead of uniform
The means to use for normal distribution. Ignored unless normally_distributed is set to TRUE.
The sds to use for normal distribution. Ignored unless normally_distributed is set to TRUE.
Introduce frequency shifts (from 4 to 12) in the ts
After what fraction of the ts to shift frequencies
Except for n and ts_names, all parameters accept either a single value or a vector of values. If a single value is supplied, that value is used for all time series being generated. If a vector is supplied, its values will be used for the corresponding series (e.g. starts[1] is used for the first series, starts[2] for the second and so on). Vectors are recycled if n is larger than their length.
If a ts_names vector is supplied, it must have length n and must not contain duplicates.
generate_random_ts()
generate_random_ts(n = 3, ranges_min = c(-10, 0, 10), ranges_max = 20, starts = 2011)
Run the code above in your browser using DataLab