# 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).
# -------------------------------------------------------------
# \donttest{
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))
Run the code above in your browser using DataLab