Testing for Interventions in Count Time Series Following Generalised Linear Models
Test for one or more interventions of given type at given time as proposed by Fokianos and Fried (2010, 2012).
- Intervention detection
"interv_test"(fit, tau, delta, external, info=c("score"), est_interv=FALSE, ...)
an object of class
"tsglm". Usually the result of a call to
- integer vector of times at which the interventions occur which are tested for.
numeric vector that determines the types of the interventions (see Details). Must be of the same length as
logical vector of length
length(tau)specifying for each intervention wether its effect is external or not (see Details). If this is only a scalar this choice will be used for all interventions. If this is only a scalar this choice will be used for all interventions. If omitted all interventions will have an internal effect (i.e.
character value that determines how to calculate the information matrix, see
"score"is the only possible choice.
logical value. If
est_interv=TRUEa fit for the model with all specified interventions is computed and additionally returned.
additional arguments passed to the fitting function
A score test on the null hypothesis of no interventions is done. The null hypothesis is that the data are generated from the model specified in the argument
model, see definition in
tsglm. Under the alternative there are one or more intervention effects occuring at times
tau. The types of the intervention effects are specified by
delta as defined in
interv_covariate. The interventions are included as additional covariates according to the definition in
tsglm. It can have an internal (the default) or external (
external=TRUE) effect (see Liboschik et al., 2014).
Under the null hypothesis the test statistic has asymptotically a chi-square distribution with
length(tau) (i.e. the number of breaks) degrees of freedom. The returned p-value is based on this and approximately valid for long time series, i.e. when
An object of class
- value of the test statistic.
- degrees of freedom of the chi-squared distribution the test statistic is compared with.
- p-value of the test.
object of class
"tsglm"with the fitted model under the null hypothesis of no intervention, see
- model specification of the model with the specified interventions. If argument
object of class
"tsglm"with the fitted model with the specified interventions, see
"interv_test", which is a list with at least the following components:
est_interv=TRUE, the following component is additionally returned:
Fokianos, K. and Fried, R. (2010) Interventions in INGARCH processes. Journal of Time Series Analysis 31(3), 210--225, http://dx.doi.org/10.1111/j.1467-9892.2010.00657.x.
Fokianos, K., and Fried, R. (2012) Interventions in log-linear Poisson autoregression. Statistical Modelling 12(4), 299--322. http://dx.doi.org/10.1177/1471082X1201200401.
Liboschik, T., Kerschke, P., Fokianos, K. and Fried, R. (2014) Modelling interventions in INGARCH processes. International Journal of Computer Mathematics (published online), http://dx.doi.org/10.1080/00207160.2014.949250.
tsglm for fitting a GLM for time series of counts.
interv_detect for detection of single interventions of given type and
interv_multiple for iterative detection of multiple interventions of unknown types.
interv_covariate for generation of deterministic covariates describing intervention effects.
###Campylobacter infections in Canada (see help("campy")) #Test for the intervention effects which were found in Fokianos und Fried (2010): campyfit <- tsglm(ts=campy, model=list(past_obs=1, past_mean=c(7,13))) campyfit_intervtest <- interv_test(fit=campyfit, tau=c(84,100), delta=c(1,0)) campyfit_intervtest