get_posteriors | R Documentation |
Computes, for each day in the sample, the posterior probability that the day is a no-information day, good-information day and bad-information day, respectively (\insertCiteEasley1992;textualPINstimation, \insertCiteEasley1996;textualPINstimation, \insertCiteErsan2016;textualPINstimation).
get_posteriors(object)
object |
(S4 object) an object of type |
If the argument object
is of type estimate.pin
, returns a dataframe of
three variables post.N
, post.G
and post.B
containing in each row the
posterior probability that a given day is a no-information day (N
),
good-information day (G
), or bad-information day (B
) respectively.
If the argument object
is of type estimate.mpin
or estimate.mpin.ecm
,
with J
layers, returns a dataframe of 2*J+1
variables Post.N
, and
Post.G[j]
and Post.B[j]
for each layer j
containing in each row the
posterior probability that a given day is a no-information day,
good-information day in layer j
or bad-information day in layer j
,
for each layer j
respectively.
If the argument object
is of any other type, an error is returned.
# 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
# ------------------------------------------------------------------------ #
# Posterior probabilities for PIN estimates #
# ------------------------------------------------------------------------ #
# Estimate PIN using the Ersan and Alici (2016) algorithm and the
# factorization Lin and Ke(2011).
estimate <- pin_ea(xdata, "LK", verbose = FALSE)
# Display the estimated PIN value
estimate@pin
# Store the posterior probabilities in a dataframe variable and display its
# first 6 rows.
modelposteriors <- get_posteriors(estimate)
show(round(head(modelposteriors), 3))
# ------------------------------------------------------------------------ #
# Posterior probabilities for MPIN estimates #
# ------------------------------------------------------------------------ #
# Estimate MPIN via the ECM algorithm, assuming that the dataset has 2
# information layers
estimate <- mpin_ecm(xdata, layers = 2, verbose = FALSE)
# Display the estimated Multilayer PIN value
show(estimate@mpin)
# Store the posterior probabilities in a dataframe variable and display its
# first six rows. The posterior probabilities are contained in a dataframe
# with 7 variables: one for no-information days, and two variables for each
# layer, one for good-information days and one for bad-information days.
modelposteriors <- get_posteriors(estimate)
show(round(head(modelposteriors), 3))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.