mpin_ml {PINstimation} | R Documentation |
MPIN model estimation via standard ML methods
Description
Estimates the multilayer probability of informed trading
(MPIN
) using the standard Maximum Likelihood method.
Usage
mpin_ml(data, layers = NULL, xtraclusters = 4, initialsets = NULL,
detectlayers = "EG", ..., verbose = TRUE)
Arguments
data |
A dataframe with 2 variables: the first corresponds to buyer-initiated trades (buys), and the second corresponds to seller-initiated trades (sells). |
layers |
An integer referring to the assumed number of
information layers in the data. If the argument |
xtraclusters |
An integer used to divide trading days into
|
initialsets |
A dataframe containing initial parameter
sets for the estimation of the |
detectlayers |
A character string referring to the layer
detection algorithm used to determine the number of layer in the data. It
takes one of three values: |
... |
Additional arguments passed on to the function |
verbose |
A binary variable that determines whether detailed
information about the steps of the estimation of the MPIN model is displayed.
No output is produced when |
Details
The argument 'data' should be a numeric dataframe, and contain
at least two variables. Only the first two variables will be considered:
The first variable is assumed to correspond to the total number of
buyer-initiated trades, while the second variable is assumed to
correspond to the total number of seller-initiated trades. Each row or
observation correspond to a trading day. NA
values will be ignored.
Value
Returns an object of class estimate.mpin
References
Ersan O (2016).
“Multilayer Probability of Informed Trading.”
Available at SSRN 2874420.
Ersan O, Alici A (2016).
“An unbiased computation methodology for estimating the probability of informed trading (PIN).”
Journal of International Financial Markets, Institutions and Money, 43, 74–94.
ISSN 10424431.
Ersan O, Ghachem M (2022a).
“Identifying information types in probability of informed trading (PIN) models: An improved algorithm.”
Available at SSRN 4117956.
Ghachem M, Ersan O (2022a).
“Estimation of the probability of informed trading models via an expectation-conditional maximization algorithm.”
Available at SSRN 4117952.
Examples
# There is a preloaded quarterly dataset called 'dailytrades' with 60
# observations. Each observation corresponds to a day and contains the
# total number of buyer-initiated trades ('B') and seller-initiated
# trades ('S') on that day. To know more, type ?dailytrades
xdata <- dailytrades
# ------------------------------------------------------------------------ #
# Estimate MPIN model using the standard ML method #
# ------------------------------------------------------------------------ #
# Estimate the MPIN model using mpin_ml() assuming that there is a single
# information layer in the data. The model is then equivalent to the PIN
# model. The argument 'layers' takes the value '1'.
# We use two extra clusters to generate the initial parameter sets.
estimate <- mpin_ml(xdata, layers = 1, xtraclusters = 2, verbose = FALSE)
# Show the estimation output
show(estimate)
# Estimate the MPIN model using the function mpin_ml(), without specifying
# the number of layers. The number of layers is then detected using Ersan and
# Ghachem (2022a).
# -------------------------------------------------------------
estimate <- mpin_ml(xdata, xtraclusters = 2, verbose = FALSE)
# Show the estimation output
show(estimate)
# Display the likelihood-maximizing parameters
show(estimate@parameters)
# Display the global multilayer probability of informed trading
show(estimate@mpin)
# Display the multilayer probabilities of informed trading per layer
show(estimate@mpinJ)
# Display the first five initial parameters sets used in the maximum
# likelihood estimation
show(round(head(estimate@initialsets, 5), 4))