Package 'acp'

Title: Autoregressive Conditional Poisson
Description: Analysis of count data exhibiting autoregressive properties, using the Autoregressive Conditional Poisson model (ACP(p,q)) proposed by Heinen (2003).
Authors: Siakoulis Vasileios
Maintainer: Siakoulis Vasilios <[email protected]>
License: GPL-2
Version: 2.1
Built: 2024-11-07 06:17:32 UTC
Source: CRAN

Help Index


Autoregressive Conditional Poisson (ACP) Regression

Description

Fit an ACP(p,q) regression model.

Usage

acp(x, ...)
## Default S3 method:
acp(x, y, p, q ,startval, varopt,...)
## S3 method for class 'formula'
acp(formula, data=list(), p, q ,startval=NULL, varopt=T, family="acp",...)
## S3 method for class 'acp'
print(x, ...)
## S3 method for class 'acp'
summary(object, ...)
## S3 method for class 'acp'
predict(object, newydata=NULL, newxdata=NULL,...)

Arguments

x

a numeric design matrix for the model.

y

a numeric vector of responses.

p

number of lags for the dependent variable.

q

number of lags for the conditional mean.

startval

a numeric vector of starting values. If not provided the package will obtain starting values for the covariate parameters from a poisson regression and for the autoregressive parameters from an arma(1,1) regression.

family

A description of the specification to be used. If family="acp" or not provided an Autoregressive Poisson regression will be estimated whereas if family="poisson" a plain Poisson regression is provided.

formula

a symbolic description of the model to be fit.

data

an optional data frame containing the variables in the model.

varopt

an optional logical operator T (TRUE) or F (FALSE) determining whether the covariance matrix will be calculated (T) or not (F).

object

an object of class "acp", i.e., a fitted model.

newxdata

a data frame containing the covariates data upon which a static forecast will be performed.

newydata

a data frame containing the dependent variable upon which a static forecast will be performed.

...

not used.

Details

This model has been proposed by Heinen (2003) for cases of count data exhibiting autoregressive behaviour. As pointed by Cameron and Trivedi (1998), when a count data set exhibits time dependence the plain Poisson regression is not adequate. Heinen (2003) proposed the ACP model in close analogy to the Autoregressive Conditional Duration model (ACD) of Engle and Russel (1998) and the GARCH model of Bollerslev (1986). The model can be also found in the international bibliography as Integer GARCH (Fokianos and Fried, 2010).

Value

An object of class logreg, basically a list including elements

coefficients

a named vector of coefficients

vcov

covariance matrix of coefficients

fitted.values

fitted values

residuals

residuals

logl

log-likelihood

AIC

AKAIKE information criterion

BIC

Bayesian information criterion

Author(s)

Siakoulis Vasileios

References

  • Bollerslev, T., 1986. Generalized autoregressive conditional heteroskedasticity. Journal of Econometrics 31, 307-327.

  • Cameron, A., and Trivedi, P., 1998. Regression Analysis of Count Data. New York: Cambridge University Press.

  • Engle, RF., Russell, JR., 1998. Autoregressive conditional duration: a new model for irregularly spaced transaction data. Econometrica 66, 1127-1162.

  • Fokianos, K., Fried, R., 2010. Interventions in INGARCH processes. Journal of Time Series Analysis 31/3, 210-225.

  • Heinen, A., 2003. Modelling Time Series Count Data: An Autoregressive Conditional Poisson Model. University Library of Munich.MPRA paper, 8113.

Examples

data(polio)

trend=(1:168/168)
cos12=cos((2*pi*(1:168))/12)
sin12=sin((2*pi*(1:168))/12)
cos6=cos((2*pi*(1:168))/6)
sin6=sin((2*pi*(1:168))/6)


#Autoregressive Conditional Poisson Model with explaning covariates
polio_data<-data.frame(polio, trend , cos12, sin12, cos6, sin6)
mod1 <- acp(polio~-1+trend+cos12+sin12+cos6+sin6,data=polio_data, p = 1 ,q = 2)
summary(mod1)

#Static out-of-sample fit example
train<-data.frame(polio_data[c(1: 119),])
mod1t <- acp(polio~-1+trend+cos12+sin12+cos6+sin6,data=train, p = 1  ,q = 2)
xpolio_data<-data.frame(trend , cos12, sin12, cos6, sin6)
test<-xpolio_data[c(120:nrow(xpolio_data)),]
yfor<-polio_data[120:nrow(polio_data),1]
predict(mod1t,yfor,test)

#Autoregressive Conditional Poisson Model without explaning covariates
polio_data<-data.frame(polio)
mod2 <- acp(polio~-1,data=polio_data, p = 3 ,q = 1)
summary(mod2)

#Poisson Model with explaning covariates
polio_data<-data.frame(polio, trend , cos12, sin12, cos6, sin6)
mod3 <- acp(polio~trend+cos12+sin12+cos6+sin6,data=polio_data,family="poisson")
summary(mod3)

#Default method for ACP regression
X<-cbind(trend , cos12, sin12, cos6, sin6)
mod4<-acp(X,polio,3,1,startval=NULL,varopt=TRUE)
print(mod4)
summary(mod4)
residuals(mod4)
mod4$vcov
mod4$AIC
mod4$BIC

Berkowitz test

Description

Implements Berkowitz test (2001) for density evaluation.

Usage

Berkowitz(ydata, yhatdata, rep, ...)

Arguments

ydata

a data frame containing the real values of the dependent varible.

yhatdata

a data frame containing the fitted values of the dependent varible.

rep

number of uniform distirbution drawings.

...

not used.

Details

Diebold et al. (1998) proposed a density evaluation method which consists in computing the sequence of cumulative probability of the observed counts under the assumed forecast distribution (Probability Transform Integral-PIT). If the density fit is adequate this sequence will be uniformly distributed and will have no-autocorrelation left neither in level nor when raised to integer powers. For this purpose intuitive graphical methods such as correlograms on the basis of the usual Bartlett confidence intervals, histograms and quantile-quantile (QQ) plots are used. In the case of discrete data Heinen et al. (2007) propose the use of a uniform zero-one continued extension as suggested by Denuit and Lambert (2005). Finally instead of using graphical tools for detecting uniformity and independence, Berkowitz (2001) applied a formal test for normality and independence of the inverse standard cumulative normal transform of the PIT sequence through the estimation of an AR(1) specification and the use of an LR test to the coefficients.

Value

P-value of the Likelihood Ratio test statistic based on the chi-square distribution with 3 degress of freedom.

Author(s)

Siakoulis Vasileios

References

  • Berkowitz, J., 2001. Testing density forecasts with applications to risk management. American Statistical Association.Journal of Business and Economics Statistics, 19, 4.

  • Denuit , M., and Lambert, P., 2005. Constraints on concordance measures in bivariate discrete data. Journal of Multivariate Analysis, 93, 40-57.

  • Diebold, F., Gunther, T., and Tay, A., 1998. Evaluating density forecasts with applications financial to risk management. International Economic Review,39, 4, 863-883.

  • Heinen,A., Rengifo, E., 2007. Multivariate autoregressive modeling of time series count data using copulas. Journal of empirical finance 14 (2007) 564-583.

Examples

data(polio)

#Create time trend and seasonality variables
trend=(1:168/168)
cos12=cos((2*pi*(1:168))/12)
sin12=sin((2*pi*(1:168))/12)
cos6=cos((2*pi*(1:168))/6)
sin6=sin((2*pi*(1:168))/6)

polio_data<-data.frame(polio, trend , cos12, sin12, cos6, sin6)
mod1 <- acp(polio~-1+trend+cos12+sin12+cos6+sin6,data=polio_data, p = 1 ,q = 2)
summary(mod1)
Berkowitz(polio_data[[1]],fitted(mod1),50)

acp Evaluation

Description

Evaluation of an acp regression model.

Usage

evaluation(ydata, yhatdata,...)

Arguments

ydata

a data frame containing the real values of the dependent varible.

yhatdata

a data frame containing the fitted values of the dependent varible.

...

not used.

Details

Diebold et al. (1998) proposed a density evaluation method which consists in computing the sequence of cumulative probability of the observed counts under the assumed forecast distribution (Probability Transform Integral-PIT). If the density fit is adequate this sequence will be uniformly distributed and will have no-autocorrelation left neither in level nor when raised to integer powers. For this purpose intuitive graphical methods such as correlograms on the basis of the usual Bartlett confidence intervals, histograms and quantile-quantile (QQ) plots are used. In the case of discrete data Heinen et al. (2007) propose the use of a uniform zero-one continued extension of the PIT as suggested by Denuit and Lambert (2005).

Value

A group of scores for count model evaluation proposed by Czado et al (2009) along with a series of evaluation plots. More precisely the measures calculated are logarithmic score, quadratic score, spherical score, ranked probability score, Dawid-Sebastiani score, squared error score, mean absolute error score and root squared error score. Relatively to the graphical evaluation, sub-plot 1 depicts the predicted relatively to the real values, sub-plot 2 the non-randomized PIT histogram (Czado et al, 2009), sub-plots 3 and 4 the first two powers of the demeaned randomized PIT and sub-plots 5 to 7 the first three powers of the Pearson standardized residuals.

Author(s)

Siakoulis Vasileios

References

  • Czado,C., Erhardt, V., Min, A., and Wagner, S., 2007. Zero-inflated generalized Poisson models with regression effects on the mean,dispersion and zero-inflation level applied to patent outsourcing rates. Statistical Modelling, 2007, 125.

  • Denuit , M., and Lambert, P., 2005. Constraints on concordance measures in bivariate discrete data. Journal of Multivariate Analysis, 93, 40-57.

  • Diebold, F., Gunther, T., and Tay, A., 1998. Evaluating density forecasts with applications financial to risk management. International Economic Review,39, 4, 863-883.

  • Heinen,A., Rengifo, E., 2007. Multivariate autoregressive modeling of time series count data using copulas. Journal of empirical finance 14 (2007) 564-583.

Examples

data(polio)

#Create time trend and seasonality variables
trend=(1:168/168)
cos12=cos((2*pi*(1:168))/12)
sin12=sin((2*pi*(1:168))/12)
cos6=cos((2*pi*(1:168))/6)
sin6=sin((2*pi*(1:168))/6)
polio_data<-data.frame(polio, trend , cos12, sin12, cos6, sin6)

mod1 <- acp(polio~-1+trend+cos12+sin12+cos6+sin6,data=polio_data, p = 1 ,q = 2)
summary(mod1)
evaluation(polio_data[[1]],fitted(mod1))

Polio cases in USA from Jan 1970 till Dec 1983

Description

The data set contains the monthly number of cases of poliomyelitis in the United States between 1970 and 1983.

Usage

data(polio)

Format

The dataset consists of one variable of 168 monthly observations.

polio

a numeric vector

Source

Zeger, S. A Regression Model for Time Series of Counts. Biometrica, Vol. 75, No 4 (Dec., 1988), pp. 621-629

Examples

data(polio)