cocoSim {coconots} | R Documentation |
Simulation of Count Time Series
Description
The function generates a time series of low counts from the (G)PAR model class for a specified innovation distribution, sample size, lag order, and parameter values.
Usage
cocoSim(
type,
order,
par,
length,
xreg = NULL,
init = NULL,
julia = FALSE,
julia_seed = NULL
)
Arguments
type |
character, either "Poisson" or "GP" indicating the type of the innovation distribution |
order |
integer, either 1 or 2 indicating the order of the model |
par |
numeric vector, the parameters of the model, the number of elements in the vector depends on the type and order specified. |
length |
integer, the number of observations in the generated time series |
xreg |
data.frame, data frame of control variables |
init |
numeric vector, initial data to use, default is NULL. See details for more information on the usage. |
julia |
If TRUE, the Julia implementation is used. In this case, init is ignored but it might be faster. |
julia_seed |
Seed for the Julia implementation. Only used if Julia equals TRUE. |
Details
The function checks for valid input of the type, order, parameters, and initial data before generating the time series.
The init parameter allows users to set a custom burn-in period
for the simulation. By default, when simulating with covariates, no burn-in
period is specified since there is no clear choice on the covariates.
However, the init argument gives users the flexibility to select an
appropriate burn-in period for the covariate case. One way to do this is to
simulate a time series using cocoSim
with appropriate covariates and pass the
resulting time series to the
init argument of a new cocoSim
run so that the first time series is used as
the burn-in period.
If init is not specified for the covariate case, a warning will be returned
to prompt the user to specify a custom burn-in period. This helps ensure that
the simulation accurately captures the dynamics of the system being modeled.
Value
a vector of the simulated time series.
Author(s)
Manuel Huth
Examples
lambda <- 1
alpha <- 0.4
set.seed(12345)
# Simulate using the RCPP implementation
data_rcpp <- cocoSim(order = 1, type = "Poisson", par = c(lambda, alpha), length = 100)
# Simulate using the Julia implementation
data_julia <- cocoSim(order = 1, type = "Poisson", par = c(lambda, alpha), length = 100)