tsglm.sim {tscount} | R Documentation |
Simulate a Time Series Following a Generalised Linear Model
Description
Generates a simulated time series from a GLM-type model for time series of counts (see tsglm
for details).
Usage
tsglm.sim(n, param = list(intercept = 1, past_obs = NULL, past_mean = NULL,
xreg = NULL), model = list(past_obs = NULL, past_mean = NULL,
external = FALSE), xreg = NULL, link = c("identity", "log"),
distr = c("poisson", "nbinom"), distrcoefs, fit, n_start = 50)
Arguments
n |
integer value giving the number of observations to be simulated. |
param |
a named list giving the parameters for the linear predictor of the model, which has the following elements:
|
model |
a named list specifying the model for the linear predictor, which has the elements |
xreg |
matrix with covariates in the columns (see |
link |
character giving the link function. Default is |
distr |
character giving the conditional distribution. Default is |
distrcoefs |
numeric vector of additional coefficients specifying the conditional distribution. For |
fit |
an object of class |
n_start |
number of observations used as a burn-in. |
Details
The definition of the model used here is like in function tsglm
.
Note that during the burn-in period covariates are set to zero.
If a previous model fit is given in argument fit
and the length of the burn-in period n_start
is set to zero, then the a continuation of the original time series is simulated.
Value
A list with the following components:
ts |
an object of class |
linear.predictors |
an object of class |
xreg.effects |
an object of class |
Author(s)
Tobias Liboschik and Philipp Probst
References
Liboschik, T., Fokianos, K. and Fried, R. (2017) tscount: An R package for analysis of count time series following generalized linear models. Journal of Statistical Software 82(5), 1–51, http://dx.doi.org/10.18637/jss.v082.i05.
See Also
tsglm
for fitting a GLM for time series of counts.
Examples
#Simulate from an INGARCH model with two interventions:
interventions <- interv_covariate(n=200, tau=c(50, 150), delta=c(1, 0.8))
model <- list(past_obs=1, past_mean=c(1, 7), external=FALSE)
param <- list(intercept=2, past_obs=0.3, past_mean=c(0.2, 0.1), xreg=c(3, 10))
tsglm.sim(n=200, param=param, model=model, xreg=interventions, link="identity",
distr="nbinom", distrcoefs=c(size=1))