Simulates a sample from a specified ACD model
and error term distribution dist
. The error terms can also be sampled from residuals. The possibility of including a diurnal seasonal component in the simulated sample is included.
sim_ACD(N = 1000, model = "ACD", dist = "exponential", param = NULL, order = NULL,
Nburn = 50, startX = c(1), startMu = c(1), errors = NULL, sampleErrors = TRUE,
roundToSec = FALSE, rm0 = FALSE, diurnalFactor = FALSE, splineObj = NULL,
open = NULL, close = NULL)
a numerical vector of simulated ACD durations
sample size
the class of conditional mean duration specification. One of "ACD"
, "LACD1"
, "LACD2"
, "AMACD"
,"ABACD"
, "SNIACD"
or "LSNIACD"
.
the distribution of the error terms (only if errors
are left out). Must be one of "exponential"
, "weibull"
, "burr"
, "gengamma"
or "genf"
.
a vector of the parameters of the DGP (data generating process).
a vector describing the order of the conditional mean duration specification, e.g. order = c(1,1)
for an ACD(1,1) model.
the number of burned observations. Used to lower the effect of the start values of the simulated series.
a vector of values to start the simulation from.
a vector of conditional mean values to start the simulation from.
a vector of error terms. If provided and sampleErrors = TRUE
the errors will be sampled from this vector (with replacement). If instead sampleErrors = FALSE
the error terms will be matched by the errors
vector non stochastic (must then be of the same length as N + Nburn
)
logical flag, see errors
above. Default is TRUE
.
if TRUE
the simulated sample will be discretized with 1 second(unit) precision.
if TRUE
zero durations will be removed. Will the result in a smaller sample than N
.
if TRUE
the simulated data will include a diurnal factor. The diurnal factor is from a fitted cubic spline given as argument to splineObj
. If the argument splineObj
is empty, a default fitted cubic spline from transData
using aggregation over weekdays will be used.
a cubic spline return by diurnalAdj()
. Currently only works with cubic splines fitted with weekday aggregation. Also see diurnalFactor
above.
only used if diurnalFactor = TRUE
and a splineObj
were provided. The time the exchange opens trading (as used in the fitted splineObj
), for example open = "10:00:00"
.
only used if diurnalFactor = TRUE
and a splineObj
were provided. The time the exchange close trading (as used in the fitted splineObj
), for example close = "18:25:00"
.
Markus Belfrage
x <- sim_ACD() #simulates 1000 observations from an ACD(1,1) with exp. errors as default
acdFit(x)
Run the code above in your browser using DataLab