acp: Autoregressive Conditional Poisson (ACP) Regression

Description Usage Arguments Details Value Author(s) References Examples

View source: R/acp.R

Description

Fit an ACP(1,1) regression model.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
acp(x, ...)
## Default S3 method:
acp(x, y, startval, varopt,...)
## S3 method for class 'formula'
acp(formula, data=list(), 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, newxdata=NULL, newydata=NULL,...)

Arguments

x

a numeric design matrix for the model.

y

a numeric vector of responses.

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). The most commonly used variant of the model is the ACP(1,1) which is implemented in the package.

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

Author(s)

Siakoulis Vasileios

References

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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)

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

##Static out-of-sample fit example
train<-data.frame(polio_data[c(1: 119),])
test<-data.frame(polio_data[c(120:nrow(polio_data)),])
vpolio<-polio_data[[1]]
yfor<-vpolio[120:nrow(polio_data)]
predict(mod1,test,yfor)

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

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

mpiktas/acp documentation built on May 17, 2017, 10:25 p.m.