AdjPIN initial parameter sets of Ersan & Ghachem (2022b)
Source:R/model_adjpin.R
initials_adjpin.Rd
Based on the algorithm in Ersan and Ghachem (2022b)
,
generates sets of initial parameters to be used in the maximum likelihood
estimation of AdjPIN
model.
Usage
initials_adjpin(data, xtraclusters = 4, restricted = list(),
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).
- xtraclusters
An integer used to divide trading days into #
(4 + xtraclusters)
clusters, thereby resulting in #comb(4 + xtraclusters - 1, 4 - 1)
initial parameter sets in line with Ersan and Alici (2016) , and Ersan and Ghachem (2022b) .The default value is4
as chosen in Ersan (2016) .- restricted
A binary list that allows estimating restricted AdjPIN models by specifying which model parameters are assumed to be equal. It contains one or multiple of the following four elements
{theta, mu, eps, d}
. For instance, Iftheta
is set toTRUE
, then the probability of liquidity shock in no-information days, and in information days is assumed to be the same (\(\theta\)=
\(\theta'\)). If any of the remaining rate elements{mu, eps, d}
is set toTRUE
, (saymu=TRUE
), then the rate is assumed to be the same on the buy side, and on the sell side (\(\mu\)b=
\(\mu\)s). If more than one element is set toTRUE
, then the restrictions are combined. For instance, if the argumentrestricted
is set tolist(theta=TRUE, eps=TRUE, d=TRUE)
, then the restricted AdjPIN model is estimated, where \(\theta\)=
\(\theta'\), \(\epsilon\)b=
\(\epsilon\)s, and \(\Delta\)b=
\(\Delta\)s. If the value of the argumentrestricted
is the empty list, then all parameters of the model are assumed to be independent, and the unrestricted model is estimated. The default value is the empty listlist()
.- verbose
a binary variable that determines whether information messages about the initial parameter sets, including the number of the initial parameter sets generated. No message is shown when
verbose
is set toFALSE
. The default value isTRUE
.
Value
Returns a dataframe of numerical vectors of ten elements {\(\alpha\), \(\delta\), \(\theta\), \(\theta'\), \(\epsilon\)b, \(\epsilon\)s, \(\mu\)b, \(\mu\)s, \(\Delta\)b, \(\Delta\)s}.
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.
The function initials_adjpin()
implements the algorithm suggested in
Ersan and Ghachem (2022b)
, and uses a hierarchical
agglomerative clustering (HAC) to find initial parameter sets for
the maximum likelihood estimation.
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 (2022b).
“A methodological approach to the computational problems in the estimation of adjusted PIN model.”
Available at SSRN 4117954.
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
# Obtain a dataframe of initial parameter sets for the maximum likelihood
# estimation using the algorithm of Ersan and Ghachem (2022b).
init.sets <- initials_adjpin(xdata)
#> The function initials_adjpin(...) has generated 15 initial parameter sets.
#>
To display them, either store them in a variable or call (initials_adjpin(...)).
#>
To hide these messages, set the argument 'verbose' to FALSE.
#>
# Use the list to estimate adjpin using the adjpin() method
# Show the value of adjusted PIN
estimate <- adjpin(xdata, initialsets = init.sets, verbose = FALSE)
show(estimate@adjpin)
#> [1] 0.3342435