Description Usage Arguments Details Value Author(s) References See Also Examples
Generates a simulated time series from a GLM-type model for time series of counts (see tsglm
for details).
1 2 3 4 |
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. |
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.
A list with the following components:
|
an object of class |
|
an object of class |
|
an object of class |
Tobias Liboschik and Philipp Probst
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.
tsglm
for fitting a GLM for time series of counts.
1 2 3 4 5 6 | #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))
|
$ts
Time Series:
Start = 1
End = 200
Frequency = 1
[1] 1 0 1 9 1 2 3 7 2 3 2 12 0 1 3 12 0 0 3 4 1 7 1 7 0
[26] 6 0 0 14 21 7 14 3 7 1 0 0 6 4 1 3 0 0 0 4 0 1 0 2 4
[51] 21 14 19 16 2 1 2 0 28 27 12 0 0 1 0 0 2 14 3 2 6 12 1 2 11
[76] 24 5 1 18 10 11 20 41 4 6 13 5 21 6 1 1 21 1 4 0 1 19 5 18 2
[101] 16 29 36 8 3 18 7 7 11 9 10 12 12 35 33 2 19 25 17 54 18 4 48 47 0
[126] 8 2 3 1 6 18 0 32 41 30 9 45 33 25 14 2 18 4 26 0 3 13 4 3 2
[151] 0 7 37 17 5 6 69 38 13 3 12 12 18 3 9 21 20 7 33 7 16 15 65 1 12
[176] 35 7 7 13 2 0 15 16 15 7 0 1 2 5 5 6 29 44 6 7 15 0 10 8 0
$linear.predictors
Time Series:
Start = 1
End = 200
Frequency = 1
[1] 3.542809 3.405812 3.090168 3.271183 5.687642 3.982563 3.982302
[8] 4.050741 5.250729 3.959163 4.018951 3.972554 6.792767 3.756784
[15] 3.456431 4.116359 6.819188 3.765733 3.150402 4.209357 4.417550
[22] 3.529153 5.217467 4.025412 5.281656 3.371371 4.895210 3.420797
[29] 3.037075 7.329162 10.168374 6.661840 7.869505 4.963422 5.434764
[36] 3.690660 3.471048 3.711047 5.208393 5.028629 3.802068 4.203890
[43] 3.209844 2.989074 2.968919 4.314623 3.365788 3.353364 3.091062
[50] 6.539197 7.806747 13.158241 12.263111 13.489201 12.833177 8.475742
[57] 7.649068 7.910488 7.897922 16.205895 17.690099 13.421337 8.531842
[64] 7.471275 7.585304 7.306853 8.081960 8.985402 12.339214 9.221027
[71] 8.191333 9.196797 11.170045 8.342205 8.166981 11.167318 15.355566
[78] 10.390247 8.297729 13.176550 11.469531 11.410604 14.398853 21.715327
[85] 11.582090 9.946191 12.206893 10.088332 14.458727 11.131631 9.697859
[92] 8.397781 13.974175 9.315524 9.071938 8.260260 8.065215 13.282829
[99] 9.996344 13.796686 9.290890 12.565372 17.039100 20.014342 12.731151
[106] 9.445865 13.668842 10.762857 10.509109 12.105732 12.122581 11.697631
[113] 11.884113 12.343707 19.045027 19.759916 10.762556 14.064769 16.482717
[120] 14.584955 25.351362 17.374775 11.650947 22.806445 25.067766 11.661825
[127] 11.190860 10.373308 9.712139 8.407522 10.762149 15.059206 9.178024
[134] 17.554691 21.848269 19.340868 12.408926 22.058000 20.817521 17.581307
[141] 14.471730 10.679173 14.469921 10.334877 17.072775 10.496307 9.757392
[148] 12.298651 9.727648 19.292522 18.491992 16.805676 16.630766 24.497892
[155] 19.506244 13.995453 13.625495 31.952020 25.813149 16.799448 12.568672
[162] 13.751554 13.299612 14.862277 12.419501 13.046690 15.814463 15.599904
[169] 11.739251 18.693104 12.417082 13.599153 13.583529 28.845376 12.666844
[176] 12.337517 19.860992 12.333249 10.942039 12.459140 10.986269 8.471861
[183] 12.434462 14.278062 13.592994 10.916048 8.431720 8.087048 8.066257
[190] 9.358027 9.800475 10.120245 16.816334 22.406983 12.090537 10.325082
[197] 12.501098 8.480490 10.708301 11.223436
$xreg.effects
Time Series:
Start = 1
End = 200
Frequency = 1
[1] 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
[8] 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
[15] 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
[22] 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
[29] 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
[36] 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
[43] 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
[50] 3.000000 3.000000 3.000000 3.000000 3.000000 3.000000 3.000000
[57] 3.000000 3.000000 3.000000 3.000000 3.000000 3.000000 3.000000
[64] 3.000000 3.000000 3.000000 3.000000 3.000000 3.000000 3.000000
[71] 3.000000 3.000000 3.000000 3.000000 3.000000 3.000000 3.000000
[78] 3.000000 3.000000 3.000000 3.000000 3.000000 3.000000 3.000000
[85] 3.000000 3.000000 3.000000 3.000000 3.000000 3.000000 3.000000
[92] 3.000000 3.000000 3.000000 3.000000 3.000000 3.000000 3.000000
[99] 3.000000 3.000000 3.000000 3.000000 3.000000 3.000000 3.000000
[106] 3.000000 3.000000 3.000000 3.000000 3.000000 3.000000 3.000000
[113] 3.000000 3.000000 3.000000 3.000000 3.000000 3.000000 3.000000
[120] 3.000000 3.000000 3.000000 3.000000 3.000000 3.000000 3.000000
[127] 3.000000 3.000000 3.000000 3.000000 3.000000 3.000000 3.000000
[134] 3.000000 3.000000 3.000000 3.000000 3.000000 3.000000 3.000000
[141] 3.000000 3.000000 3.000000 3.000000 3.000000 3.000000 3.000000
[148] 3.000000 3.000000 13.000000 11.000000 9.400000 8.120000 7.096000
[155] 6.276800 5.621440 5.097152 4.677722 4.342177 4.073742 3.858993
[162] 3.687195 3.549756 3.439805 3.351844 3.281475 3.225180 3.180144
[169] 3.144115 3.115292 3.092234 3.073787 3.059030 3.047224 3.037779
[176] 3.030223 3.024179 3.019343 3.015474 3.012379 3.009904 3.007923
[183] 3.006338 3.005071 3.004056 3.003245 3.002596 3.002077 3.001662
[190] 3.001329 3.001063 3.000851 3.000681 3.000544 3.000436 3.000348
[197] 3.000279 3.000223 3.000178 3.000143
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.