acdFit: ACD (Autoregressive Conditional Duration) Model Fitting

View source: R/acdFit.R

acdFitR Documentation

ACD (Autoregressive Conditional Duration) Model Fitting


This function estimates various ACD models with various assumed error term distributions, using Maximum Likelihood Estimation.

The currently available models (conditional mean specifications) are:

Standard ACD, Log-ACD (two alternative specifications), AMACD, ABACD, SNIACD and LSNIACD.

The currently available distributions are:

Exponential (also used for QML), Weibull, Burr, generalized Gamma, and generalized F.


acdFit(durations = NULL, model = "ACD", dist = "exponential", 
    order = NULL, startPara = NULL,  dailyRestart = 0, optimFnc = "optim",
    method = "Nelder-Mead", output = TRUE, bootstrapErrors = FALSE, 
    forceErrExpec = TRUE, fixedParamPos = NULL, bp = NULL, 
    exogenousVariables = NULL, control = list())



either (1) a data frame including, at least, a column named 'durations' or 'adjDur' (for adjusted durations), or (2) a vector of durations


the conditional mean model specification. Must be one of "ACD", "LACD1", "LACD2", "AMACD", "BACD", "ABACD", "SNIACD" or "LSNIACD". See 'Details' for detailed model specification.


the assumed error term distribution. Must be one of "exponential", "weibull", "burr", "gengamma", "genf", "qweibull", "mixqwe", "mixqww", or "mixinvgauss". See 'Details' for detailed model specification.


a vector detailing the order of the particular ACD model. For example an ACD(p, q) specification should have order = c(p, q).


a vector with parameter values to start the maximization algorithm from. Must be in the correct order according to the model specification (see Details).


if TRUE the conditional duration will start fresh every new trading day. Can only be used if the durations arguments included the clock time of the durations, or if the time argument was provided.


Specifies which optimization function to use for the estimation. "optim", "nlminb", "solnp", and "optimx" are available.


Argument passed to the optimization function if optimFnc = "optim" or optimFnc = "optimx" were chosen. Specifies the optimization algorithm. See the help files for optim, nlminb or solnp.


if FALSE the estimation results won't be printed.


if TRUE the standard errors will be computed by using bootstrap simulations. Currently only works with the standard ACD model.


if TRUE the expectation of the error terms' distribution will be forced to be 1, otherwise the distribution parameter specifying the mean will be set to 1 to ensure identification.


a logical vector of TRUE and FALSE. Can only be used if the argument startPara were provided, and should be of the same length. Each element represents the respective start parameter and if TRUE, this parameter will be held fixed when estimating the other parameters.


used only for the SNIACD or LSNIACD model. A vector of break points.


specifies the columns in the durations data.frame that should be used as exogenous variables when fitting the model. Must be a vector, either with the column positions or the names of the columns. It is highly recommended to standardize the exogenous variables before running the estimation.


a list of control values,


maximum number of iterations performed by the numerical maximization algorithm.


an integer. If this is set to diffrent to 0, the values of the parameters each time the optimization function calls the log likelihood function. This search path of the MLE will then be plotted. Also passed on to the optimization function, see the help files for optim, nlminb or solnp.


number of bootstrap samples


The startPara argument is a vector of the parameter values to start from. The length of the vector naturally depends on the model and distribution. The first elements represent the model parameters, and the last elements the distribution parameters. For example for an ACD(1,1) with Weibull errors the first 3 elements are ω, α_1, β_1 for the model, and the last is γ for the Weibull distribution.

The family of ACD models are

x_i = μ_i ε_i,

where different specifications of the conditional mean duration μ_i and the error term ε_i give rise to different models as shown below.

When exogenous variables are used, they are added in the form of

∑_{j=1}^{k} ξ_j z_j

to the right hand side of the equations, where z_j are the exogenous variables.

Conditional mean duration μ_i specifications according to the model argument:

ACD(p, q) specification: (Engle and Russell, 1998)

μ_i = ω + ∑_{j=1}^{p} α_j x_{i-j} + ∑_{j=1}^{q} β_j μ_{i-j}

The element order of the startPara vector is (ω, α_j...,β_j...).

LACD1(p, q): (Bauwens and Giot, 2000)

\lnμ_i = ω + ∑_{j=1}^{p} α_j \ln ε_{i-j} + ∑_{j=1}^{q} β_j \ln μ_{i-j}

The element order of the startPara vector is (ω, α_j...,β_j...).

LACD2(p, q): (Lunde, 1999)

\lnμ_i = ω + ∑_{j=1}^{p} α_j ε_{i-j} + ∑_{j=1}^{q} β_j \ln μ_{i-j}

The element order of the startPara vector is (ω, α_j...,β_j...).

AMACD(p, r, q) (Additive and Multiplicative ACD): (Hautsch , 2012)

μ_i = ω + ∑_{j=1}^{p} α_j x_{i-j} + ∑_{j=1}^{r} ν_j ε_{i-j} + ∑_{j=1}^{q} β_j μ_{i-j}

The element order of the startPara vector is (ω, α_j...,ν_j...,β_j...).

ABACD(p, q) (Augmented Box-Cox ACD): (Hautsch, 2012)

μ_i^{δ_1} = ω + ∑_{j=1}^{p} α_j ≤ft( |ε_{i-j}-ν|+c_j|ε_{i-j}-b| \right)^{δ_2} + ∑_{j=1}^{q} β_j μ_{i-j}^{δ_1}

The element order of the startPara vector is (ω, α_j..., c_j..., β_j..., ν, δ_1, δ_2).

BACD(p, q) (Box-Cox ACD): (Hautsch, 2003)

μ_i^{δ_1} = ω + ∑_{j=1}^{p} α_j ε_{i-j}^{δ_2} + ∑_{j=1}^{q} β_j μ_{i-j}^{δ_1}

The element order of the startPara vector is (ω, α_j..., β_j...).

SNIACD(p, q, M) (Spline News Impact ACD): (Hautsch, 2012, with a slight difference)

μ_i = ω + ∑_{j=1}^{p} (α_{j-1}+c_0) ε_{i-j} + ∑_{j=1}^{p} ∑_{k=M}^{r} (α_{j-1}+c_k)1_{(ε_{i-j} ≤ \bar{ε_k})}+∑_{j=1}^{q} β_j μ_{i-j},

where 1_{()} is an indicator function and α_0=0.
The element order of the startPara vector is (ω, c_k..., α_j..., β_j...) (The number of α-parameters are p-1]).

The distribution of the error term ε_i specifications according to the dist argument:

Exponential distribution, dist = "exponential":


Weibull distribution, dist = "weibull":

f(ε)=θ γ ε^{γ-1}e^{-θ ε^{γ}} ,

where θ=[Γ(γ^{-1}+1)]^{γ} if forceErrExpec = TRUE.

Burr distribution, dist = "burr":

f(ε)= \frac{θ κ ε^{κ-1}}{(1+σ^2 θ ε^{κ})^{\frac{1}{σ^2}+1}},


θ= σ^{2 ≤ft(1+\frac{1}{κ}\right)} \frac{Γ ≤ft(\frac{1}{σ^2}+1\right)}{Γ ≤ft(\frac{1}{κ}+1\right) Γ ≤ft(\frac{1}{σ^2}-\frac{1}{κ}\right)},

if forceErrExpec = TRUE.
The element order of the startPara vector is (model parameters, κ, σ^2).

Generalized Gamma distribution, dist = "gengamma":

f(ε)=\frac{γ ε^{κ γ - 1}}{λ^{κ γ}Γ (κ)}\exp ≤ft\{{-≤ft(\frac{ε}{λ}\right)^{γ}}\right\}

where λ=\frac{Γ(κ)}{Γ(κ+\frac{1}{γ})} if forceErrExpec = TRUE. The element order of the startPara vector is (model parameters, κ, γ).

Generalized F distribution, dist = "genf":

f(ε)= \frac{γ ε^{κ γ -1}[η+(ε/λ)^{γ}]^{-η-κ}η^{η}}{λ^{κ γ}B(κ,η)},

where B(κ,η)=\frac{Γ(κ)Γ(η)}{Γ(κ+η)}, and if forceErrExpec = TRUE,


The element order of the startPara vector is (model parameters, κ, η, γ).

q-Weibull distribution, dist = "qweibull":

f(ε) = (2-q)\frac{a}{b^a} ε^{a-1} ≤ft[1-(1-q)≤ft(\frac{ε}{b}\right)^a\right]^{\frac{1}{1-q}}

where if forceErrExpec = TRUE,

b = \frac{(q-1)^{\frac{1+a}{a}}}{2-q}\frac{aΓ(\frac{1}{q-1})}{Γ(\frac{1}{a}) Γ(\frac{1}{q-1}-\frac{1}{a}-1)}.

The element order of the startPara vector is (model parameters, a, q).


a list of class "acdFit" with the following slots:


the durations object used to fit the model.


a vector of the estimated conditional mean durations


the residuals from the fitted model, calculated as durations/mu


the model for the conditional mean durations


the order of the model


the assumed error term distribution


the internal code used to represent the distribution


a vector of the estimated conditional mean duration parameters


a vector of the estimated error distribution parameters


total number of parameters


a data.frame with the log likelihood, AIC, BIC, and MSE calculated as the mean squared deviation of the durations and the estimated conditional durations.


a data.frame with the estimated coefficients and their standard errors and p-values


the value of the unfree distribution parameter. If forceErrExpec = TRUE were used, this parameter is a function of the other distribution parameters, to force the mean of the distribution to be one. Otherwise the parameter was fixed at 1 to ensure identification.


the numerical hessian of the log likelihood evaluated at the estimate


number of observations


number of log-likelihood evaluations needed for the maximization algorithm


if the maximization algorithm converged, this value is zero. (see the help file optim, nlminb or solnp)


time required for estimation


who fitted the model and when


only available for QML estimation (choosing the exponential distribution) for the standard ACD(p, q) model. The robust correlation matrix of the parameter estimates.


Markus Belfrage


Bauwens, L., and P. Giot (2000) The logarithmic ACD model: an application to the bid-ask quote process of three NYSE stocks. Annales d'Economie et de Statistique, 60, 117-149.

Engle R.F, Russell J.R. (1998) Autoregressive Conditional Duration: A New Model for Irregularly Spaced Transaction Data, Econometrica, 66(5): 1127-1162.

Grammig, J., and Maurer, K.-O. (2000) Non-monotonic hazard functions and the autoregressive conditional duration model. Econometrics Journal 3: 16-38.

Hautsch, N. (2003) Assessing the Risk of Liquidity Suppliers on the Basis of Excess Demand Intensities. Journal of Financial Econometrics (2003) 1 (2): 189-215

Hautsch, N. (2012) Econometrics of Financial High-Frequency Data. Berlin, Heidelberg: Springer.

Lunde, A. (1999): A generalized gamma autoregressive conditional duration model, Working paper, Aalborg University.


fitModel <- acdFit(durations = adjDurData, model = "ACD", 
            dist = "exponential", order = c(1,1), dailyRestart = 1)

ACDm documentation built on Nov. 16, 2022, 5:09 p.m.