View source: R/simulateDriver.R
simulateDriver | R Documentation |
Generates a vector of the same legnth as the time
argument, with a temporal autocorrelation length close to the defined by autocorrelation.length
, and a range within output.min
and output.max
. The output of this function is intended to be used as an input to the function simulatePopulation
. Important: note that the variable time
runs from left to right in simulatePopulation
, with lower values representing older samples.
simulateDriver( random.seed = 30, time = 1:10000, autocorrelation.length = 100, output.min = 0, output.max = 100, rescale = TRUE )
random.seed |
integer, seed 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 1 to the given integer as seq(1, time, by = 1). Default is 1:10000. |
autocorrelation.length |
integer, represents the length of the convolution filter to be used to impose a particular temporal structure on the time series. Default is 100, equivalent to a filter composed by a hundred of ones. |
output.min |
numeric, minimum value of the output time series. Used as input for |
output.max |
numeric, maximum value of the output time series. Used as input for |
rescale |
boolean. If FALSE, |
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. The initial random sequence of numers 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
.
A vector of the same length as time
. Datasets driverA
and driverB
are outputs of this function.
Blas M. Benito <blasbenito@gmail.com>
rescaleVector
, driverA
, driverB
, set.seed
x <- simulateDriver( random.seed = 30, time = 1:10000, autocorrelation.length = 100, output.min = -10, output.max = 20, rescale = TRUE ) #plots output plot(x, type = "l") #checks temporal autocorrelation acf(x, lag.max = 300)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.