Skip to contents

Overview of the package

An overview of the PINstimation package, and its main functionalities.

PINstimation-package
An R package for estimating the probability of informed trading

Factorizations of PIN likelihood functions

Log-transformations of the different PIN likelihood functions (PIN, MPIN, AdjPIN) to avoid floating-point errors.

fact_pin_eho() fact_pin_lk() fact_pin_e() fact_mpin() fact_adjpin()
Factorizations of the different PIN likelihood functions

Original PIN model

Initial sets for PIN estimation

Implementation of the algorithms developed to generate initial parameter sets for the estimation of the original PIN model.

initials_pin_ea()
Initial parameter sets of Ersan & Alici (2016)
initials_pin_gwj()
Initial parameter set of Gan et al.(2015)
initials_pin_yz()
Initial parameter sets of Yan and Zhang (2012)

Estimation of PIN model

Implementation of maximum likelihood estimation of the original PIN model using the different algorithms of initial parameter sets.

pin()
PIN estimation - custom initial parameter sets
pin_bayes()
PIN estimation - Bayesian approach
pin_ea()
PIN estimation - initial parameter sets of Ersan & Alici (2016)
pin_gwj()
PIN estimation - initial parameter set of Gan et al. (2015)
pin_yz()
PIN estimation - initial parameter sets of Yan & Zhang (2012)

Simulation of PIN Data

Using the function generatedata_mpin(), we can generate data following the original PIN model by setting the argument layers to 1.

generatedata_mpin()
Simulation of MPIN model data

PIN posterior probabilities

Computation of posterior probabilties of trading days at the optimal probabilities, and rate parameters.

get_posteriors()
Posterior probabilities for PIN and MPIN estimates

Multilayer PIN model

Layer Detection in datasets

Implementation of the different algorithms of MPIN information layer detection in trade data.

detectlayers_e() detectlayers_eg() detectlayers_ecm()
Layer detection in trade-data

Initial sets for MPIN estimation

Implementation of the algorithm of Ersan (2016) to generate initial parameter sets for the estimation of the multilayer PIN model.

initials_mpin()
MPIN initial parameter sets of Ersan (2016)

Estimation of MPIN model

Implementation of maximum likelihood estimation of the multilayer PIN model using standard methods, and the Expectation-Maximization algorithm.

mpin_ecm()
MPIN model estimation via an ECM algorithm
mpin_ml()
MPIN model estimation via standard ML methods

Simulation of MPIN Data

Using either random, or provided parameters, or range of parameters; generation of levels of daily buyer-initiated, and seller-initated trades following the distribution of trade levels in the multilayer PIN model.

generatedata_mpin()
Simulation of MPIN model data

MPIN posterior probabilities

Computation of posterior probabilties of trading days at the optimal probabilities, and rate parameters.

get_posteriors()
Posterior probabilities for PIN and MPIN estimates

Adjusted PIN model

Initial sets for AdjPIN estimation

Implementation of three algorithms to generate initial parameter sets for the estimation of the Adjusted PIN model.

initials_adjpin()
AdjPIN initial parameter sets of Ersan & Ghachem (2022b)
initials_adjpin_cl()
AdjPIN initial parameter sets of Cheng and Lai (2021)
initials_adjpin_rnd()
AdjPIN random initial sets

Estimation of AdjPIN model

Implementation of maximum likelihood estimation of the Adjusted PIN model using standard methods, and the Expectation-Maximization algorithm.

adjpin()
Estimation of adjusted PIN model

Simulation of AdjPIN Data

Using random parameters, provided parameters, or range(s) of parameters; generation of levels of daily buyer-initiated, and seller-initated trades following the distribution of trade levels in the Adjusted PIN model.

generatedata_adjpin()
Simulation of AdjPIN model data.

Volume-Synchronized PIN model

Implementation of estimation of the volume-synchronized PIN model.

vpin()
Estimation of Volume-Synchronized PIN model

Aggregation of high-frequency data

Implementation of four classification algorithms in order to aggregate high frequency data into daily data.

aggregate_trades()
Aggregation of high-frequency data

Datasets

Preloaded data sets used in illustrating examples throughout the package.

dailytrades
Example of quarterly data
hfdata
High-frequency trade-data

Data simulation classes

Details of the S4 classes used to generate S4 objects that contain the generation parameters of the generated datasets or series of datasets.

show(<dataset>)
Simulated data object
show(<data.series>)
List of dataset objects

Estimation results classes

Details of the S4 classes used to generate S4 objects that contain the estimation results of the different estimation functions.

show(<estimate.adjpin>)
AdjPIN estimation results
show(<estimate.mpin>)
MPIN estimation results
show(<estimate.mpin.ecm>) selectModel() getSummary()
MPIN estimation results (ECM)
show(<estimate.pin>)
PIN estimation results
show(<estimate.vpin>)
VPIN estimation results

Other functions

Function to customize the display of outputs in the R console.

set_display_digits()
Package-wide number of digits