| pinbasic | R Documentation |
Utilities for fast and stable
estimation of the probability of informed trading (PIN) in the model introduced by Easley, Hvidkjaer and O'Hara (EHO, 2002) are implemented.
Since the model developed by Easley, Kiefer, O'Hara and Paperman (EKOP, 1996) is nested in the EHO model due to
equating the intensity of uninformed buys and sells, functionalities can also be applied
to this simpler model structure, if needed.
State-of-the-art factorization of the model likelihood function as well as hierarchical agglomerative clustering algorithm
for generating initial values for optimization routines are provided.
In total, two different likelihood factorizations and three methodologies generating starting values are implemented.
The probability of informed trading can be estimated for arbitrary length of daily buys and sells data with
pin_est function which is a wrapper around the workhorse function pin_est_core.
No information about the time span of the underlying data is required to perform optimizations.
However, recommendation given in the literature is using at least data for 60 trading days to ensure convergence of the
likelihood maximization.
The qpin function delivers quarterly estimates.
The number of available quarters in the data are detected utilizing functions from the lubridate package.
Quarterly estimates can be visualized with the ggplot function.
Datasets of daily aggregated numbers of buys and sells can be simulated with simulateBS.
Calculation of confidence intervals for the probability of informed trading can be enabled by confint argument in
optimization routines (pin_est_core, pin_est and qpin) or by calling pin_confint directly.
Additionally, posterior probabilities for conditions of trading days can be computed with posterior and
plotted with ggplot.
ggplot.posteriorVisualization method for results of posterior with ggplot2.
ggplot.qpinVisualization method for results of qpin with ggplot2.
initial_valsGenerating initial values by brute force grid search, hierarchical agglomerative clustering algorithm or refined hierarchical agglomerative clustering technique.
posteriorCalculation of posterior probabilities of trading days' conditions.
pin_calcComputing the probability of informed trading (PIN).
pin_confintCalculation of confidence intervals for the probability of informed trading.
pin_est_coreCore function of maximization routines for PIN likelihood function. It grants the most control over optimization procedure.
However, the settings chosen in pin_est will be sufficient in most applications.
pin_estUser-friendly wrapper around pin_est_core. Default method for creating initial values is set to
hierarchical agglomerative clustering, the likelihood formulation defaults to the one proposed by
Lin and Ke (2011).
pin_llEvaluating likelihood function values either utilizing the factorization by Easley et. al (2010) or Lin and Ke (2011).
qpinReturns quarterly estimates, function is a wrapper around pin_est and
inherits its optimization settings.
simulateBSSimulate datasets of aggregated daily buys and sells.
BSinfrequentA matrix containing three months of synthetic daily buys and sells data representing an infrequently traded stock.
BSfrequentA matrix containing three months of synthetic daily buys and sells data representing a frequently traded stock.
BSheavyA matrix containing three months of synthetic daily buys and sells data representing a heavily traded stock.
BSfrequent2015A matrix containing one year of synthetic daily buys and sells data representing a frequently traded stock. Rownames equal the business days in 2015.
Source of all included datasets: own simulation
Andreas Recktenwald (Saarland University, Statistics & Econometrics)
Email: a.recktenwald@mx.uni-saarland.de
https://github.com/anre005/pinbasic
Easley, David et al. (2002)
Is Information Risk a Determinant of Asset Returns?
The Journal of Finance, Volume 57, Number 5, pp. 2185 - 2221
doi: 10.1111/1540-6261.00493
Easley, David et al. (1996)
Liquidity, Information, and Infrequently Traded Stocks
The Journal of Finance, Volume 51, Number 4, pp. 1405 - 1436
doi: 10.1111/j.1540-6261.1996.tb04074.x
Easley, David et al. (2010)
Factoring Information into Returns
Journal of Financial and Quantitative Analysis, Volume 45, Issue 2, pp. 293 - 309
doi: 10.1017/S0022109010000074
Ersan, Oguz and Alici, Asli (2016)
An unbiased computation methodology for estimating the probability of informed trading (PIN)
Journal of International Financial Markets, Institutions and Money, Volume 43, pp. 74 - 94
doi: 10.1016/j.intfin.2016.04.001
Gan, Quan et al. (2015)
A faster estimation method for the probability of informed trading
using hierarchical agglomerative clustering
Quantitative Finance, Volume 15, Issue 11, pp. 1805 - 1821
doi: 10.1080/14697688.2015.1023336
Grolemund, Garett and Wickham, Hadley (2011)
Dates and Times Made Easy with lubridate
Journal of Statistical Software, Volume 40, Issue 3, pp. 1 - 25
doi: 10.18637/jss.v040.i03
Lin, Hsiou-Wei William and Ke, Wen-Chyan (2011)
A computing bias in estimating the probability of informed trading
Journal of Financial Markets, Volume 14, Issue 4, pp. 625 - 640
doi: 10.1016/j.finmar.2011.03.001
Wickham, Hadley (2009)
ggplot2: Elegant Graphics for Data Analysis
Springer-Verlag New York
doi: 10.1007/978-0-387-98141-3
Wickham, Hadley (2007)
Reshaping Data with the reshape Package
Journal of Statistical Software, Volume 21, Issue 12, pp. 1 - 20
doi: 10.18637/jss.v021.i12
Wickham, Hadley (2016)
scales: Scale Functions for Visualization
R package version 0.4.0
Yan, Yuxing and Zhang, Shaojun (2012)
An improved estimation method and empirical properties of the probability of informed trading
Journal of Banking & Finance, Volume 36, Issue 2, pp. 454 - 467
doi: 10.1016/j.jbankfin.2011.08.003
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.