initials_adjpin | R Documentation |
Based on the algorithm in \insertCiteErsan2022b;textualPINstimation,
generates sets of initial parameters to be used in the maximum likelihood
estimation of AdjPIN
model.
initials_adjpin(data, xtraclusters = 4, restricted = list(),
verbose = TRUE)
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
# |
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
|
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 |
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
\insertCiteErsan2022b;textualPINstimation, and uses a hierarchical
agglomerative clustering (HAC) to find initial parameter sets for
the maximum likelihood estimation.
Returns a dataframe of numerical vectors of ten elements
{\alpha
, \delta
, \theta
, \theta'
,
\eb, \es, \mub, \mus, \Db, \Ds}.
# 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)
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.