initials_pin_gwj | R Documentation |
Based on the algorithm in
\insertCiteGan2015;textualPINstimation, generates an initial parameter
set for the maximum likelihood estimation of the PIN
model.
initials_pin_gwj(data, 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). |
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.
Returns a dataframe containing numerical vector of five elements
{\alpha
, \delta
, \mu
, \eb, \es}.
# 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 the initial parameter set for the maximum likelihood estimation
# using the algorithm of Gan et al.(2015).
initparams <- initials_pin_gwj(xdata)
# Use the obtained dataframe to estimate the PIN model using the function
# pin() with custom initial parameter sets
estimate.1 <- pin(xdata, initialsets = initparams, verbose = FALSE)
# pin_gwj() directly estimates the PIN model using an initial parameter set
# generated using the algorithm of Gan et al.(2015).
estimate.2 <- pin_gwj(xdata, "E", verbose = FALSE)
# Check that the obtained results are identical
show(estimate.1@parameters)
show(estimate.2@parameters)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.