Description Usage Arguments Details Value References See Also Examples
Calling estimate_mlekop()
estimates the parameters from the model of Easley
et al. (1996, EKOP) together with the probability of informed trading (PIN).
As described in the EKOP model trade data for buy and sell trades are needed,
respectively. Note that in contrast the compressed EKOP model needs only data
for the number of trades per day (see the function references below).
1 2 3 4 5 6 7 8 9 10 11 12 |
data |
A |
startpar |
A vector containing start parameters for maximum likelihood estimation. These must be starting values for the logit of alpha, epsilon, the logit of delta, and mu. If no starting values are provided the function chooses the values (0, mean(trades)x.75/2, 0, mean(trades)x.25/2). |
T |
A double specifying the minutes of a trading day. |
methodLik |
A character specifying, if undefined function values in
optimization should be approximated by large defined values ( |
fnLik |
A character specifying which likelihood function to use. Either the original function by Easley et al. (1996) or the slightly modified variant of Easley et al. (2002) can be used. The latter one is known to also work better with large trading volumes. |
fnscale |
A negatve double specifying a scaling factor for the likelihood function. This can in some cases help when the algorithm does not reach convergence or suffer from number overflow. |
trace |
An integer specifying which level of tracing should be used.
see |
grad_free |
A logical indicating if gradient-free optimization should
be used when gradient descent did not converge. If |
return_opt |
A logical indicating, if in addition to the PIN estimates
also the results from the optimization procedure should be returned. If
|
opt_out |
(Deprecated) A logical indicating if only the output of the
optimization procedure should be returned. Some older applications still
rely on this output. In the next version this feature will be removed.
Note that the default value is |
There exist different likelihood variants that can be used in maximum likelihood estimation of the EKOP model.
compute_ekop_orig_lik
uses the likelihood function proposed in the original
paper of Easley et al. (1996).
compute_ekop_lik
uses a likelihood that is modified in regard to deal
better with computational overflow. This likelihood function had been
presented in slightly modified version by Easley et al. (2002).
Furthermore, to deal with undefined function values like NaN
or inf
an
approximation method can be chosen by the argument methodLik
. Choosing
"approx"
then approximates values of NaN
, -inf
or inf
by values
1e+6
, -1e+6
, and 1e+6
, respectively and basically ignores the
occurrence of undefined values.
Optimization is performed gradient-based by using
the optim
function. The algorithm used is the L-BFGS-B
that allows for parameter restrictions. This is necessary because we use for
the probabilities alpha
and delta
the logistic transformation
exp()/(1+exp())
to produce valid probabilities in optimization.
In case that the gradient-based algorithm does not converge in between 100
steps, a gradient-free optimization is applied. For gradient-free
optimization nmkb
, a bounded Nelder-Mead
algorithm
is used. Derivative-free optimization is only performed after gradient-based
optimization did not converge and the argument grad_free
is TRUE
.
The argument fnscale
can be used to scale the likelihood function in case
of very large values (e.g. very large volumes) that might lead to number
overflow during computation. Note, fnscale
must always be negative as the
likelihood function should be maximized.
A list
with all components as returned by
optim
or nmkb
.
Easley, D., Kiefer, N., O’Hara, M., Paperman, J., 1996. Liquidity, information, and infrequently traded stocks. Journal of Finance 51, 1405–1436.
Easley, David, Hvidkjaer, Soeren, and O’Hara, Maureen (2002). “Is Information Risk a Determinant of Asset Returns?” In: The Journal of Finance 57.5, pp. 2185–2221. DOI: 10.1111/1540-6261.00493.
estimate_pin()
for estimating the PIN with a Bayesian approach that
needs only the total number of trades
estimate_compml()
for estimating the PIN with the compressed EKOP model
that needs only the total number of trades
compute_ekop_lik()
for the implementation of the likelihood function of
the paper of Easley et al. (2002)
compute_ekop_orig_lik()
for the implementation of the likelihood function
of the paper of Easley et al. (1996)
1 2 3 4 5 6 | # Simulate data from the EKOP model.
trades_data <- simulate_ekop()
# Estimate the EKOP model by maximum likelihood.
pin_estml <- estimate_mlekop(trades_data, methodLik="approx",
fnLik="compute_ekop_orig_lik", opt_out=FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.