CountTimeSeries.IIDModelType
IIDModel

Struct to specify an IID model. It contains information on

  • distr: Distribution
  • link: Link function
  • X: Regressor matrix
  • external: Indicator which regressors enter the system externally
  • zi: Indicator. Is zero inflation modelled?
CountTimeSeries.INARCHModelType
INARCHModel

Struct to specify an INARCH model. It contains information on

  • distr: Distribution
  • link: Link function
  • pastObs: Past observations included in the conditional mean definition
  • X: Regressor matrix
  • external: Indicator which regressors enter the system externally
  • zi: Indicator. Is zero inflation modelled?
CountTimeSeries.INARMAType
INARMA

Abstract type which summarizes all models in the INARMA framework. Subtype of CountModel.

CountTimeSeries.INARMAModelType
INARMAModel

Struct to specify an INARMA model. It contains information on

  • distr: Distributions (vector)
  • link: Link functions (vector)
  • pastObs: Past observations included
  • pastMean: Past mean included
  • X: Regressor matrix
  • external: Indicator which regressors enter the system externally
  • zi: Indicator. Is zero inflation modelled?
CountTimeSeries.INARMAresultsType
INARMAResults(y, θ, pars,
  LL, LLs, nPar, nObs, se, CI, Σ,
  model, converged, MLEControl)
  • y: Time series
  • θ: Estimates (vector)
  • pars: Estimates (parameter)
  • LL: Maximum of likelihood
  • LLs: Likelihood contributions
  • nPar: Number of parameters
  • nObs: Number of observations
  • se: Standard errors
  • CI: Confidence intervals
  • Σ: Covariance matrix of estimator
  • model: Model specification
  • converged: Indicator, convergence of optimization routine?
  • MLEControl: Estimation settings used
CountTimeSeries.INARModelType
INARModel

Struct to specify an INAR model. It contains information on

  • distr: Distributions (vector)
  • link: Link functions (vector)
  • pastObs: Past observations included
  • X: Regressor matrix
  • external: Indicator which regressors enter the system externally
  • zi: Indicator. Is zero inflation modelled?
CountTimeSeries.INGARCHType
INGARCH

Abstract type which summarizes all models in the INGARCH framework. Subtype of CountModel.

CountTimeSeries.INGARCHModelType
INGARCHModel

Struct to specify an INGARCH model. It contains information on

  • distr: Distribution
  • link: Link function
  • pastObs: Past observations included in the conditional mean definition
  • pastMean: Past mean included in the conditional mean definition
  • X: Regressor matrix
  • external: Indicator which regressors enter the system externally
  • zi: Indicator. Is zero inflation modelled?
CountTimeSeries.INGARCHresultsType
INGARCHResults(y, θ, pars, λ, residuals,
      LL, LLs, nPar, nObs, se, CI, Σ,
      model, converged, MLEControl)

Structure for estimation results.

  • y: Time series
  • θ: Estimates (vector)
  • pars: Estimates (parameter)
  • λ: Conditional means
  • residuals: Residuals (y - λ)
  • LL: Maximum of likelihood
  • LLs: Likelihood contributions
  • nPar: Number of parameters
  • nObs: Number of observations
  • se: Standard errors
  • CI: Confidence intervals
  • Σ: Covariance matrix of estimator
  • model: Model specification
  • converged: Indicator, convergence of optimization routine?
  • MLEControl: Estimation settings used
CountTimeSeries.INMAModelType
INMAModel

Struct to specify an INMA model. It contains information on

  • distr: Distributions (vector)
  • link: Link functions (vector)
  • pastMean: Past mean included
  • X: Regressor matrix
  • external: Indicator which regressors enter the system externally
  • zi: Indicator. Is zero inflation modelled?
CountTimeSeries.MLEControlType
MLEControl(init::parameter, optimizer::String, ci::Bool, maxEval::Int64)

Structure for esitmation settings.

  • init: Initial values for optimization
  • optimizer: Optimizing Routine, "NelderMead", "BFGS" or "LBFGS"
  • ci: Indicator: Shall confidence intervals be computed?
  • maxEval: Maximum number of likelihood evaluations
CountTimeSeries.parameterType
parameter(β0, α, β, η, ϕ, ω)

Structure for Count Data models parameters.

  • β0: Intercept parameter
  • α: Parameters for autoregression
  • β: Parameters for MA part/past means
  • η: Regressor parameters
  • ϕ: Overdispersion parameter (Negative Binomial)
  • ω: Zero inflation probability

For details, see For details, see Documentation

Base.:∘Method

Thinning operator for p∘X, d∘X or p∘d.

  • p: Thinning probability (∈ [0, 1])
  • X: Positive integer
  • d: Discrete distribution

Random numbers are generated according to (binomial) thinning.

p∘X computes $\sum_{i = 1}^X{Z_i}$ with $Z_i\sim\text{Bin}(1, p)$

d∘X computes $\sum_{i = 1}^X{Z_i}$ with $Z_i\sim$ d

p∘d computes $\sum_{i = 1}^X{Z_i}$ with $Z_i\sim\text{Bin}(1, n)$ and $X\sim$ d

CountTimeSeries.AICFunction
AIC(results, dropfirst)

Computing the Akaike information criterion.

  • results: Result from fitting a count data model.
  • dropfirst: Can be used to exclude the first observations from computation.

Examples

AIC(res1, 2) # res1: Results from INARCH(1) fit
AIC(res2)    # res2: Results from INARCH(2) fit
CountTimeSeries.BICFunction
BIC(results, dropfirst)

Computing the Bayes information criterion.

  • results: Result from fitting a count data model.
  • dropfirst: Can be used to exclude the first observations from computation.

Examples

BIC(res1, 2) # res1: Results from INARCH(1) fit
BIC(res2)    # res2: Results from INARCH(2) fit
CountTimeSeries.HQICFunction
HQIC(results, dropfirst)

Computing the Hannan-Quinn information criterion.

  • results: Result from fitting a count data model.
  • dropfirst: Can be used to exclude the first observations from computation.

Examples

HQIC(res1, 2) # res1: Results from INARCH(1) fit
HQIC(res2)    # res2: Results from INARCH(2) fit
CountTimeSeries.MLESettingsMethod
MLESettings(y, model, init, optimizer, ci)

Wrapper function to specify estimation settings.

  • y: Time series
  • model: Model specification
  • init: Initial values (vector or parameter).
  • optimizer: Optimization routine. "BFGS", "LBFGS" or "NelderMead"
  • ci: Indicator: Shall confidence intervals be computed?
  • maxEval: Maximum number of likelihood evaluations

Example

MLESettings(y, model, ci = true, maxEval = 1e9)

If the argument init is not given, valid initial values are chosen. See also MLEControl.

CountTimeSeries.ModelMethod
Model(model, distr, link, pastObs, pastMean, X,
      external, zi)

Wrapper function to define count data models. Default setting is an an IID Poisson process without regressors or zero inflation.

Structs have entries:

  • distr: "Poisson" or "Negative Binomial" (Vector for INARMA)
  • link: Vector of length two, "Linear" or "Log" (Vector for INARMA)
  • pastObs: Lags considered in autoregressive part
  • pastMean: Lags considered in MA/past conditional mean part
  • X: Matrix of regressors (row-wise)
  • external: Indicator(s) if regressors enter externally
  • zi: Indicator, zero inflation Y/N

Examples

Model(pastObs = 1:2, pastMean = 1) # INGARCH(2, 1)
Model(pastObs = [1, 2], distr = "NegativeBinomial") # NB-INARCH(2)
Model(model = "INARMA", pastMean = 1, zi = true) # Zero inflated INMA(1)

For further details, see Documentation

CountTimeSeries.QPoisMethod
QPois(results)

Add-on function for Quasi Poisson estimation of INGARCH models.

  • results: Estimation results (only INGARCH)

Example

QPois(results)

The function uses estimation results of an INGARCH fit with Poisson distribution and estimates the overdispersion parameter according to Christou and Fokianos (2013). The function puts out a changed version of the input including an estimate of the overdispersion parameter. The distribution is thereby changed to "NegativeBinomial".

CountTimeSeries.acfMethod
acf(model, θ, lagMax, ofλ)

Autocorrelation function of INGARCH(p, q) process. Models with regressors or logarithmic link are not covered.

  • model: Model specification
  • θ: Parameters (Vector or parameter type)
  • lagMax: Maximum lag to be computed
  • ofλ: If true, return ACVF/ACF of conditional mean sequence

Examples

model = Model(pastObs = 1)
acf(model, [10, 0.5])
CountTimeSeries.acfMethod
acf(model, θ, lagMax)

Autocorrelation function of INARMA(p, q) process. Models with regressors are not covered.

  • model: Model specification
  • θ: Parameters (Vector or parameter type)
  • lagMax: Maximum lag to be computed

Examples

model = Model(model = "INARMA", pastObs = 1)
acf(model, [10, 0.5])
CountTimeSeries.acvfMethod
acvf(model, θ, lagMax, ofλ)

Autocovariance function of INGARCH(p, q) process. Models with regressors or logarithmic link are not covered.

  • model: Model specification
  • θ: Parameters (Vector or parameter type)
  • lagMax: Maximum lag to be computed
  • ofλ: If true, return ACVF/ACF of conditional mean sequence

Examples

model = Model(pastObs = 1)
acvf(model, [10, 0.5])
CountTimeSeries.acvfMethod
acvf(model, θ, lagMax)

Autocovariance function of INARMA(p, q) process. Models with regressors are not covered.

  • model: Model specification
  • θ: Parameters (Vector or parameter type)
  • lagMax: Maximum lag to be computed

Examples

model = Model(model = "INARMA", pastObs = 1)
acvf(model, [10, 0.5])
CountTimeSeries.llMethod
ll(y, model, θ; initiate = "first")

Likelihood function for Count Data models.

  • y: Time series
  • model: Model Specification
  • θ: Parameters (Vector or parameter)
  • initiate: How is the time series initiated?

The time series can be initiated by "first", the first observed value, "intercept", the intercept parameter (possibly exponentiated if log-link), or "marginal", the marginal mean of the process.

Example

ll(y, model, pars)
CountTimeSeries.par2θMethod
par2θ(θ, model)

Function two convert parameter struct to vector

  • θ: Parameter struct
  • model: Model specification CountModel, INGARCHModel, ...

Example

model = CountModel(past_obs = 1) # Specify INARCH(1)
pars = θ2par([10, 0.5], model)
θ = par2θ(pars, model)
CountTimeSeries.parametercheckMethod
parametercheck(θ, model)

Check if parameters are admissable.

  • θ: Parameters (vector or parameter)
  • model: Model specification

Example

model = Model(pastObs = 1)
parametercheck([10, 0.3], model)

Parameters are admissible if they yield strictly positive conditional means and further fulfill stationarity properties.

CountTimeSeries.pitMethod
pit(results, nbins, level)

Function to compute the non-randomized PIT histogram, see Czado et al..

  • results: Estimation results
  • nbins: Number of bins (optional, default = 10)
  • level: Confidence level (optional)

Example

pit(res, 10, 0.95)

If the argument level is put in, a confidence regio is added to the PIT histogram. The height of all bins is inside that region if the PIT values follow a uniform distribution.

CountTimeSeries.predictMethod
predict(results, h, nChain, Xnew)

Function for forecasting Count Data models.

  • results: Estimation results
  • h: Number of steps to forecast
  • nChain: Number of Chains for simulation based forecast (optional)
  • Xnew: New values for regressors (only in case of regressors)

Example

# 10-step-ahead forecast
predict(results, 10, 10000)

The function either returns point forecasts if nChain is not specified or generates multiple time series according to estiamtion results. The latter is used to compute forecast intervals and is the default for INARMA models.

CountTimeSeries.simulateMethod
simulate(T, model, θ; burnin, pinfirst)

Function to generate time series from Count Data model.

  • T: Length of time series
  • model: Model specification
  • θ: Parameters (vector or struct)
  • burnin: Number of burnin observations, default 500
  • pinfirst: Set values for first observations (instead of burnin)

Example

model = CountModel(pastObs = 1)
simulate(100, model, [10, 0.5])
CountTimeSeries.θ2parMethod
θ2par(θ, model)

Function two convert parameter vector to struct

  • θ: Parameter vector
  • model: Model specification CountModel, INGARCHModel, INARMAModel, ...

Parameter vector needs to be of suitable length.

Example

model = Model(pastObs = 1) # Specify INARCH(1)
θ2par([10, 0.5], model)
Statistics.meanMethod
mean(model, θ, ofλ = false)

Marginal mean of INGARCH(p, q) process. Models with regressors or a logarithmic link are not covered.

  • model: Model specification
  • θ: Parameters (Vector or parameter type)
  • ofλ: If true, the marginal mean of the conditional mean sequence is returned

Examples

model = Model(pastObs = 1)
mean(model, [10, 0.5])
Statistics.meanMethod
mean(model, θ)

Marginal mean of INARMA(p, q) process. Models with regressors are not covered.

  • model: Model specification
  • θ: Parameters (Vector or parameter type)

Examples

model = Model(model = "INARMA", pastObs = 1)
mean(model, [10, 0.5])
Statistics.varMethod
var(model, θ, ofλ = false)

Marginal variance of INGARCH(p, q) process. Models with regressors or a logarithmic link are not covered.

  • model: Model specification
  • θ: Parameters (Vector or parameter type)
  • ofλ: If true, the marginal mean of the conditional mean sequence is returned

Examples

model = Model(pastObs = 1)
var(model, [10, 0.5])
Statistics.varMethod
var(model, θ)

Marginal variance of INARMA(p, q) process. Models with regressors are not covered.

  • model: Model specification
  • θ: Parameters (Vector or parameter type)

Examples

model = Model(model = "INARMA", pastObs = 1)
var(model, [10, 0.5])