PINstimation: An R Package for Estimating Probability of Informed Trading Models

Abstract:

The purpose of this paper is to introduce the R package PINstimation. The package is designed for fast and accurate estimation of the probability of informed trading models through the implementation of well-established estimation methods. The models covered are the original PIN model , the multilayer PIN model , the adjusted PIN model , and the volume- synchronized PIN . These core functionalities of the package are supplemented with utilities for data simulation, aggregation and classification tools. In addition to a detailed overview of the package functions, we provide a brief theoretical review of the main methods implemented in the package. Further, we provide examples of use of the package on trade-level data for 58 Swedish stocks, and report straightforward, comparative and intriguing findings on informed trading. These examples aim to highlight the capabilities of the package in tackling relevant research questions and illustrate the wide usage possibilities of PINstimation for both academics and practitioners.

Cite PDF Supplement

Published

Nov. 1, 2023

Received

Jun 27, 2022

DOI

10.32614/RJ-2023-044

Volume

Pages

15/2

145 - 168


0.1 Supplementary materials

Supplementary materials are available in addition to this article. It can be downloaded at RJ-2023-044.zip

Footnotes

    References

    D. Abad and J. Yagüe. From PIN to VPIN: An introduction to order flow toxicity. Spanish Review of Financial Economics, 10(2): 74–83, 2012. DOI 10.1016/j.srfe.2012.10.002.
    H.-J. Ahn, J. Kang and D. Ryu. Informed trading in the index option market: The case of KOSPI 200 options. Journal of Futures Markets, 28(12): 1118–1146, 2008. DOI 10.1002/FUT.20369.
    O. U. Aktas and L. Kryzanowski. Trade classification accuracy for the BIST. Journal of International Financial Markets, Institutions and Money, 33: 259–282, 2014. DOI 10.1016/j.intfin.2014.08.003.
    H. Aslan, D. Easley, S. Hvidkjaer and M. O’Hara. The characteristics of informed trading: Implications for asset pricing. Journal of Empirical Finance, 18(5): 782–801, 2011. DOI 10.1016/J.JEMPFIN.2011.08.001.
    H. Bengtsson. A unifying framework for parallel and distributed processing in r using futures. The R Journal, 13(2): 208–227, 2021. URL https://doi.org/10.32614/RJ-2021-048.
    H. Berkman, P. D. Koch and P. J. Westerholm. Informed trading through the accounts of children. Journal of Finance, 69(1): 363–404, 2014. DOI 10.1111/jofi.12043.
    J. Bjursell, G. H. K. Wang and H. Zheng. VPIN, jump dynamics and inventory announcements in energy futures markets. Journal of Futures Markets, 37(6): 542–577, 2017. DOI 10.1002/fut.21839.
    D. Bongaerts, D. Rösch and M. A. Van Dijk. Cross-sectional identification of informed trading. SSRN Electronic Journal, 2014. DOI 10.2139/ssrn.2532128.
    M. Bugeja, V. Patel and T. Walter. The microstructure of australian takeover announcements. Australian Journal of Management, 40(1): 161–188, 2015. DOI 10.1177/0312896213517247.
    D. Celik and M. Tiniç. InfoTrad: An r package for estimating the probability of informed trading. R Journal, 10(1): 31–42, 2018.
    D. Celik and M. Tiniç. InfoTrad: Calculates the probability of informed trading (PIN). 2017. URL https://CRAN.R-project.org/package=InfoTrad. R package version 1.2.
    S. S. Chang, V. L. Chang and F. A. Wang. A dynamic intraday measure of the probability of informed trading and firm-specific return variation. Journal of Empirical Finance, 29: 80–94, 2014. DOI 10.1016/j.jempfin.2014.02.003.
    Y. Chen and H. Zhao. Informed trading, information uncertainty, and price momentum. Journal of Banking and Finance, 36(7): 2095–2109, 2012. DOI 10.1016/J.JBANKFIN.2012.03.016.
    T. C. Cheng and H. N. Lai. Improvements in estimating the probability of informed trading models. Quantitative Finance, 21(5): 771–796, 2021. DOI 10.1080/14697688.2020.1800805.
    J. Duarte and L. Young. Why is PIN priced? Journal of Financial Economics, 91(2): 119–138, 2009. DOI 10.1016/j.jfineco.2007.10.008.
    D. Easley, M. M. L. De Prado and M. O’Hara. The microstructure of the "flash crash": Flow toxicity, liquidity crashes, and the probability of informed trading. Journal of Portfolio Management, 37(2): 118–128, 2011. DOI 10.3905/jpm.2011.37.2.118.
    D. Easley, R. F. Engle, M. O’hara and L. Wu. Time-varying arrival rates of informed and uninformed trades. Journal of Financial Econometrics, 6(2): 171–207, 2008. DOI 10.1093/jjfinec/nbn003.
    D. Easley, S. Hvidkjaer and M. O’Hara. Factoring information into returns. Journal of Financial and Quantitative Analysis, 45(2): 293–309, 2010. DOI 10.1017/S0022109010000074.
    D. Easley, S. Hvidkjaer and M. O’Hara. Is information risk a determinant of asset returns? The Journal of Finance, 57(5): 2185–2221, 2002. DOI 10.1111/1540-6261.00493.
    D. Easley, N. M. Kiefer and M. O’Hara. The information content of the trading process. Journal of Empirical Finance, 4(2-3): 159–186, 1997. DOI 10.1016/S0927-5398(97)00005-4.
    D. Easley, N. M. Kiefer, M. O’Hara and J. B. Paperman. Liquidity, information, and infrequently traded stocks. The Journal of Finance, 51(4): 1405, 1996. DOI 10.2307/2329399.
    D. Easley, M. M. López De Prado and M. O’Hara. Flow toxicity and liquidity in a high-frequency world. Review of Financial Studies, 25(5): 1457–1493, 2012. DOI 10.1093/rfs/hhs053.
    D. Easley and M. O’Hara. Time and the process of security price adjustment. Journal of Finance, 47(2): 577–605, 1992.
    K. Ellis, R. Michaely and M. O’Hara. The accuracy of trade classification rules: Evidence from nasdaq. The Journal of Financial and Quantitative Analysis, 35(4): 529, 2000. DOI 10.2307/2676254.
    O. Ersan. Multilayer probability of informed trading. SSRN Electronic Journal, 2016. DOI 10.2139/ssrn.2874420.
    O. Ersan and A. Alıcı. An unbiased computation methodology for estimating the probability of informed trading (PIN). Journal of International Financial Markets, Institutions and Money, 43: 74–94, 2016. DOI 10.1016/j.intfin.2016.04.001.
    O. Ersan and M. Ghachem. A methodological approach to the computational problems in the estimation of adjusted PIN model. SSRN Electronic Journal, 2022a.
    O. Ersan and M. Ghachem. Identifying information types in probability of informed trading (PIN) models: An improved algorithm. SSRN Electronic Journal, 2022b.
    O. Ersan, S. A. Simsir, K. D. Simsek and A. Hasan. The speed of stock price adjustment to corporate announcements: Insights from turkey. Emerging Markets Review, 47: 100778, 2021. DOI 10.1016/j.ememar.2020.100778.
    Q. Gan, W. C. Wei and D. Johnstone. A faster estimation method for the probability of informed trading using hierarchical agglomerative clustering. Quantitative Finance, 15(11): 1805–1821, 2015. DOI 10.1080/14697688.2015.1023336.
    M. Ghachem and O. Ersan. Estimation of the probability of informed trading models via an expectation maximization algorithm. SSRN Electronic Journal, 2022.
    J. Griffin, J. Oberoi and S. D. Oduro. Estimating the probability of informed trading: A bayesian approach. Journal of Banking and Finance, 125: 2021. DOI https://doi.org/10.1016/j.jbankfin.2021.106045.
    H. Guo and B. Qiu. A better measure of institutional informed trading. Contemporary Accounting Research, 33(2): 815–850, 2016. DOI 10.1111/1911-3846.12160.
    J. Hasbrouck. Measuring the information content of stock trades. The Journal of Finance, 46(1): 179–207, 1991. DOI 10.1111/j.1540-6261.1991.tb03749.x.
    W. liang G. Hsieh and H. R. He. Informed trading, trading strategies and the information content of trading volume: Evidence from the taiwan index options market. Journal of International Financial Markets, Institutions and Money, 31(1): 187–215, 2014. DOI 10.1016/j.intfin.2014.03.012.
    R. D. Huang and H. R. Stoll. Dealer versus auction markets: A paired comparison of execution costs on NASDAQ and the NYSE. Journal of Financial Economics, 41(3): 313–357, 1996. DOI 10.1016/0304-405X(95)00867-E.
    R. D. Huang and H. R. Stoll. The components of the bid-ask spread: A general approach. Review of Financial Studies, 10(4): 995–1034, 1997. DOI 10.1093/rfs/10.4.995.
    M. A. Jenkins and J. F. Traub. Algorithm 419: Zeros of a complex polynomial [c2]. Communications of the ACM, 15(2): 97–99, 1972.
    S. G. Johnson. The NLopt nonlinear-optimization package. 2022.
    C. M. C. Lee and M. J. Ready. Inferring trade direction from intraday data. The Journal of Finance, 46(2): 733–746, 1991. DOI 10.1111/j.1540-6261.1991.tb02683.x.
    E. Lin and C.-F. Lee. Application of poisson mixtures in the estimation of probability of informed trading. In Handbook of financial econometrics and statistics, pages. 2601–2619 2015. Springer.
    W. Lin and W. Ke. A computing bias in estimating the probability of informed trading. Journal of Financial Markets, 14(4): 625–640, 2011. DOI 10.1016/j.finmar.2011.03.001.
    A. Madhavan, M. Richardson and M. Roomans. Why do security prices change? A transaction-level analysis of NYSE stocks. Review of Financial Studies, 10(4): 1035–1064, 1997. DOI 10.1093/rfs/10.4.1035.
    J. A. Nelder and R. Mead. A simplex method for function minimization. The computer journal, 7(4): 308–313, 1965.
    S. K. Ng, T. Krishnan and G. J. McLachlan. The EM algorithm. In Handbook of computational statistics, pages. 139–172 2012. Springer.
    E. R. Odders-White. On the occurrence and consequences of inaccurate trade classification. Journal of Financial Markets, 3(3): 259–286, 2000. DOI 10.1016/S1386-4181(00)00006-9.
    M. Piwowar and L. Wei. The sensitivity of effective spread estimates to trade–quote matching algorithms. Electronic Markets, 16(2): 112–129, 2006. DOI 10.1080/10196780600643803.
    A. Recktenwald. Advanced methods for estimating the probability of informed trading. Saarländische Universitäts-und Landesbibliothek, 2019. DOI http://dx.doi.org/10.22028/D291-31254.
    A. Recktenwald. Pinbasic: Fast and stable estimation of the probability of informed trading (PIN). 2018. URL https://CRAN.R-project.org/package=pinbasic. R package version 1.2.2.
    D. Vaughan and M. Dancho. Furrr: Apply mapping functions in parallel using futures. 2022. https://github.com/DavisVaughan/furrr, https://furrr.futureverse.org/.
    Y. Yan and S. Zhang. An improved estimation method and empirical properties of the probability of informed trading. Journal of Banking and Finance, 36(2): 454–467, 2012. DOI 10.1016/j.jbankfin.2011.08.003.
    X. Yin and J. Zhao. A hidden markov model approach to information-based trading: Theory and applications. Journal of Applied Econometrics, 30(7): 1210–1234, 2015. DOI 10.1002/jae.2412.

    Reuse

    Text and figures are licensed under Creative Commons Attribution CC BY 4.0. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".

    Citation

    For attribution, please cite this work as

    Ghachem & Ersan, "PINstimation: An R Package for Estimating Probability of Informed Trading Models", The R Journal, 2023

    BibTeX citation

    @article{RJ-2023-044,
      author = {Ghachem, Montasser and Ersan, Oguz},
      title = {PINstimation: An R Package for Estimating Probability of Informed Trading Models},
      journal = {The R Journal},
      year = {2023},
      note = {https://doi.org/10.32614/RJ-2023-044},
      doi = {10.32614/RJ-2023-044},
      volume = {15},
      issue = {2},
      issn = {2073-4859},
      pages = {145-168}
    }