| simulateDriverS {virtualPollen} | R Documentation |
Generates drivers for simulatePopulation.
Description
Wrapper of simulateDriver to generate several drivers with different autocorrelation lengths, and return a long format dataframe to be used as input for simulatePopulation. It also produces a plot of the generated drivers. Important: note that the variable time runs from left to right, with lower values representing older samples.
Usage
simulateDriverS(
random.seeds=c(60, 120),
time=1:10000,
autocorrelation.lengths=c(200, 600),
output.min=c(0,0),
output.max=c(100, 100),
driver.names=c("A", "B"),
filename=NULL)
Arguments
random.seeds |
vector of integers, seeds to be used by |
time |
integer, or numeric vector of integers with constant intervals. If a single integer is provided, a time sequence is generated from 0 to the given integer as seq(0, time, by = 1). Default is 1:10000. |
autocorrelation.lengths |
vector of integers, represents the lengths of the convolution filters to be used to impose a particular temporal structure on each driver. Default is 100, equivalent to a filter composed by a hundred of ones. |
output.min |
numeric vector, minimum values of the output time series. Used as input for rescaleVector. Default is 0. |
output.max |
numeric vector, maximum values of the output time series. Used as input for rescaleVector. Default is 100. |
driver.names |
character vector, with labels to be used to identify the drivers. |
filename |
character string, name of output pdf file. If NULL or empty, no pdf is produced. |
Details
It is recommended to use time vectors with a time step of 1 between consecutive values when the output is to be used as input for simulatePopulation, which considers annual time-steps while simulating virtual pollen curves. Initial random sequence is generated by rnorm. Desired temporal autocorrelation are approximate, but deviation becomes higher if autocorrelation.length is larger than half the length of time. Consequently, the function limits autocorrelation.length to length(time)/2.
Value
A long format dataframe (see dataset drivers) with the following columns:
-
time: integer.
-
driver: character, values are
AandB -
autocorrelation.length: numeric, default values are 200, 600, and 1800.
-
value: numeric, value of the driver for the given time.
Author(s)
Blas M. Benito <blasbenito@gmail.com>
See Also
drivers, simulateDriver, simulatePopulation, drivers
Examples
drivers <- simulateDriverS(
random.seeds=c(60, 120),
time=1:10000,
autocorrelation.lengths=c(200, 600),
output.min=c(0,0),
output.max=c(100, 100),
driver.names=c("A", "B"),
filename=NULL
)
str(drivers)