Learn R Programming

tscount (version 1.4.3)

interv_test.tsglm: Testing for Interventions in Count Time Series Following Generalised Linear Models

Description

Test for one or more interventions of given type at given time as proposed by Fokianos and Fried (2010, 2012).

Usage

# S3 method for tsglm
interv_test(fit, tau, delta, external, 
            info=c("score"), est_interv=FALSE, ...)

Arguments

fit

an object of class "tsglm". Usually the result of a call to tsglm.

tau

integer vector of times at which the interventions occur which are tested for.

delta

numeric vector that determines the types of the interventions (see Details). Must be of the same length as tau.

external

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. external=FALSE).

info

character value that determines how to calculate the information matrix, see tsglm. Currently "score" is the only possible choice.

est_interv

logical value. If est_interv=TRUE a fit for the model with all specified interventions is computed and additionally returned.

...

additional arguments passed to the fitting function tsglm.

Value

An object of class "interv_test", which is a list with at least the following components:

test_statistic

value of the test statistic.

df

degrees of freedom of the chi-squared distribution the test statistic is compared with.

p_value

p-value of the test.

fit_H0

object of class "tsglm" with the fitted model under the null hypothesis of no intervention, see tsglm.

model_interv

model specification of the model with the specified interventions.

If argument est_interv=TRUE, the following component is additionally returned:

fit_interv

object of class "tsglm" with the fitted model with the specified interventions, see tsglm.

Details

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 length(ts) large.

References

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. (2016) Modelling count time series following generalized linear models. PhD Thesis TU Dortmund University, http://dx.doi.org/10.17877/DE290R-17191.

Liboschik, T., Kerschke, P., Fokianos, K. and Fried, R. (2016) Modelling interventions in INGARCH processes. International Journal of Computer Mathematics 93(4), 640--657, http://dx.doi.org/10.1080/00207160.2014.949250.

See Also

S3 method print.

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.

Examples

Run this code
# NOT RUN {
###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
# }

Run the code above in your browser using DataLab