CountTimeSeries.CountModel
— TypeCountModel
Abstract type which summarizes all models in the CountTimeSeries.jl package.
CountTimeSeries.IIDModel
— TypeIIDModel
Struct to specify an IID model. It contains information on
distr
: Distributionlink
: Link functionX
: Regressor matrixexternal
: Indicator which regressors enter the system externallyzi
: Indicator. Is zero inflation modelled?
CountTimeSeries.INARCHModel
— TypeINARCHModel
Struct to specify an INARCH model. It contains information on
distr
: Distributionlink
: Link functionpastObs
: Past observations included in the conditional mean definitionX
: Regressor matrixexternal
: Indicator which regressors enter the system externallyzi
: Indicator. Is zero inflation modelled?
CountTimeSeries.INARMA
— TypeINARMA
Abstract type which summarizes all models in the INARMA framework. Subtype of CountModel.
CountTimeSeries.INARMAModel
— TypeINARMAModel
Struct to specify an INARMA model. It contains information on
distr
: Distributions (vector)link
: Link functions (vector)pastObs
: Past observations includedpastMean
: Past mean includedX
: Regressor matrixexternal
: Indicator which regressors enter the system externallyzi
: Indicator. Is zero inflation modelled?
CountTimeSeries.INARMAresults
— TypeINARMAResults(y, θ, pars,
LL, LLs, nPar, nObs, se, CI, Σ,
model, converged, MLEControl)
y
: Time seriesθ
: Estimates (vector)pars
: Estimates (parameter)LL
: Maximum of likelihoodLLs
: Likelihood contributionsnPar
: Number of parametersnObs
: Number of observationsse
: Standard errorsCI
: Confidence intervalsΣ
: Covariance matrix of estimatormodel
: Model specificationconverged
: Indicator, convergence of optimization routine?MLEControl
: Estimation settings used
CountTimeSeries.INARModel
— TypeINARModel
Struct to specify an INAR model. It contains information on
distr
: Distributions (vector)link
: Link functions (vector)pastObs
: Past observations includedX
: Regressor matrixexternal
: Indicator which regressors enter the system externallyzi
: Indicator. Is zero inflation modelled?
CountTimeSeries.INGARCH
— TypeINGARCH
Abstract type which summarizes all models in the INGARCH framework. Subtype of CountModel.
CountTimeSeries.INGARCHModel
— TypeINGARCHModel
Struct to specify an INGARCH model. It contains information on
distr
: Distributionlink
: Link functionpastObs
: Past observations included in the conditional mean definitionpastMean
: Past mean included in the conditional mean definitionX
: Regressor matrixexternal
: Indicator which regressors enter the system externallyzi
: Indicator. Is zero inflation modelled?
CountTimeSeries.INGARCHresults
— TypeINGARCHResults(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 meansresiduals
: Residuals (y - λ)LL
: Maximum of likelihoodLLs
: Likelihood contributionsnPar
: Number of parametersnObs
: Number of observationsse
: Standard errorsCI
: Confidence intervalsΣ
: Covariance matrix of estimatormodel
: Model specificationconverged
: Indicator, convergence of optimization routine?MLEControl
: Estimation settings used
CountTimeSeries.INMAModel
— TypeINMAModel
Struct to specify an INMA model. It contains information on
distr
: Distributions (vector)link
: Link functions (vector)pastMean
: Past mean includedX
: Regressor matrixexternal
: Indicator which regressors enter the system externallyzi
: Indicator. Is zero inflation modelled?
CountTimeSeries.MLEControl
— TypeMLEControl(init::parameter, optimizer::String, ci::Bool, maxEval::Int64)
Structure for esitmation settings.
init
: Initial values for optimizationoptimizer
: Optimizing Routine, "NelderMead", "BFGS" or "LBFGS"ci
: Indicator: Shall confidence intervals be computed?maxEval
: Maximum number of likelihood evaluations
CountTimeSeries.parameter
— Typeparameter(β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 integerd
: 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.AIC
— FunctionAIC(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.BIC
— FunctionBIC(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.HQIC
— FunctionHQIC(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.MLESettings
— MethodMLESettings(y, model, init, optimizer, ci)
Wrapper function to specify estimation settings.
y
: Time seriesmodel
: Model specificationinit
: 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.Model
— MethodModel(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 partpastMean
: Lags considered in MA/past conditional mean partX
: Matrix of regressors (row-wise)external
: Indicator(s) if regressors enter externallyzi
: 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.QPois
— MethodQPois(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.acf
— Methodacf(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 computedofλ
: If true, return ACVF/ACF of conditional mean sequence
Examples
model = Model(pastObs = 1)
acf(model, [10, 0.5])
CountTimeSeries.acf
— Methodacf(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.acvf
— Methodacvf(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 computedofλ
: If true, return ACVF/ACF of conditional mean sequence
Examples
model = Model(pastObs = 1)
acvf(model, [10, 0.5])
CountTimeSeries.acvf
— Methodacvf(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.ll
— Methodll(y, model, θ; initiate = "first")
Likelihood function for Count Data models.
y
: Time seriesmodel
: 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θ
— Methodpar2θ(θ, model)
Function two convert parameter struct to vector
θ
: Parameter structmodel
: Model specification CountModel, INGARCHModel, ...
Example
model = CountModel(past_obs = 1) # Specify INARCH(1)
pars = θ2par([10, 0.5], model)
θ = par2θ(pars, model)
CountTimeSeries.parametercheck
— Methodparametercheck(θ, 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.pit
— Methodpit(results, nbins, level)
Function to compute the non-randomized PIT histogram, see Czado et al..
results
: Estimation resultsnbins
: 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.predict
— Methodpredict(results, h, nChain, Xnew)
Function for forecasting Count Data models.
results
: Estimation resultsh
: Number of steps to forecastnChain
: 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.simulate
— Methodsimulate(T, model, θ; burnin, pinfirst)
Function to generate time series from Count Data model.
T
: Length of time seriesmodel
: Model specificationθ
: Parameters (vector or struct)burnin
: Number of burnin observations, default 500pinfirst
: Set values for first observations (instead of burnin)
Example
model = CountModel(pastObs = 1)
simulate(100, model, [10, 0.5])
CountTimeSeries.θ2par
— Methodθ2par(θ, model)
Function two convert parameter vector to struct
θ
: Parameter vectormodel
: 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.mean
— Methodmean(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.mean
— Methodmean(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.var
— Methodvar(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.var
— Methodvar(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])