5
$\begingroup$

I am trying to perform a simple time series analysis with count time series data. My data is a sequence of small integer values like 0,1,2 and 3. I learned from various sources that INAR model would be appropriate with such data.

My question is whether anyone knows R codes for fitting a simple INAR(1) model (regressing time series data on a binary dummy variable).

Appreciate any assistance.

$\endgroup$

3 Answers 3

2
$\begingroup$

For count time series data you can also fit Autoregressive Conditional Poisson model. Here is a link to an article describing it. There is also an R package acp. I used it recently and I got some decent results.

$\endgroup$
1
  • $\begingroup$ is the ACP model equivalent to the INAR model? $\endgroup$
    – crow
    Commented Jul 27, 2017 at 21:58
1
$\begingroup$

Have you looked at the LaplacesDemon package? They have some examples for autoregressive poisson. http://cran.cermin.lipi.go.id/web/packages/LaplacesDemon/vignettes/Examples.pdf

$\endgroup$
0
$\begingroup$

For modeling integer-valued time series (or any non-Gaussian time series), I would opt for a State-Space model that allows the latent dynamic process to evolve independently of the observations. This is very useful when dealing with observations that have restrictions, such as non-negative integers or proportional values, because we can let the latent dynamic process be real-valued and use the convenience of link functions (like we do in Generalized Linear Models) to translate to the observation scale. My package {mvgam} was designed specifically for this kind of situation because I frequently have to analyse and forecast multivariate sets of count-valued time series with missing values, many zeros and overdispersion, and none of the more commonly used methods (such as the INAR) are capable of dealing with all of these features. I also wanted the ability to include nonlinear smooth functions of covariates (using Generalized Additive Models) in both the latent process model and in the observation model, because again many real-world time series have observation error that needs to be captured.

The general formula for Dynamic Generalized Additive Models is:

$$for~i~in~1:N_{series}~...$$ $$for~t~in~1:N_{timepoints}~...$$ $$g^{-1}(\tilde{\boldsymbol{y}}_{i,t})=\alpha_{i}+\sum\limits_{j=1}^Js_{i,j,t}\boldsymbol{x}_{j,t}+Zz_{i,t}\,,$$

Here $\alpha$ are the unknown intercepts, the $\boldsymbol{s}$'s are unknown smooth functions of covariates ($\boldsymbol{x}$'s), which can potentially vary among the response series, and $z$ are dynamic latent processes. Each smooth function $s_j$ is composed of basis expansions whose coefficients, which must be estimated, control the functional relationship between $\boldsymbol{x}_{j}$ and $g^{-1}(\tilde{\boldsymbol{y}})$. The size of the basis expansion limits the smooth’s potential complexity. A larger set of basis functions allows greater flexibility. Note that we can also include linear predictors for the $z$, which is often useful to do, and we can impose a wide variety of temporal dynamic structures (such as Random Walk, AR processes, Continuous Time AR processes, or even Vector Autoregressions). The $Z$ matrix affords even more flexibility by letting some series share the same latent process model (i.e. perhaps two observation series are tracking the same hidden process, but with different observation errors). For more information on GAMs and how they can smooth through data, see this blogpost on how to interpret nonlinear effects from Generalized Additive Models.

To see how this can work for integer-valued time series, you can read through this short worked example.

Generalized Additive Models for time series

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.