Skip to contents

Based on an extension of the algorithm in Cheng and Lai (2021) , generates sets of initial parameters to be used in the maximum likelihood estimation of AdjPIN model.

Usage

initials_adjpin_cl(data, restricted = list(), verbose = TRUE)

Arguments

data

A dataframe with 2 variables: the first corresponds to buyer-initiated trades (buys), and the second corresponds to seller-initiated trades (sells).

restricted

A binary list that allows estimating restricted AdjPIN models by specifying which model parameters are assumed to be equal. It contains one or multiple of the following four elements {theta, mu, eps, d}. For instance, If theta is set to TRUE, then the probability of liquidity shock in no-information days, and in information days is assumed to be the same (\(\theta\)=\(\theta'\)). If any of the remaining rate elements {mu, eps, d} is set to TRUE, (say mu=TRUE), then the rate is assumed to be the same on the buy side, and on the sell side (\(\mu\)b=\(\mu\)s). If more than one element is set to TRUE, then the restrictions are combined. For instance, if the argument restricted is set to list(theta=TRUE, eps=TRUE, d=TRUE), then the restricted AdjPIN model is estimated, where \(\theta\)=\(\theta'\), \(\epsilon\)b=\(\epsilon\)s, and \(\Delta\)b=\(\Delta\)s. If the value of the argument restricted is the empty list, then all parameters of the model are assumed to be independent, and the unrestricted model is estimated. The default value is the empty list list().

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 verbose is set to FALSE. The default value is TRUE.

Value

Returns a dataframe of numerical vectors of ten elements {\(\alpha\), \(\delta\), \(\theta\), \(\theta'\), \(\epsilon\)b, \(\epsilon\)s, \(\mu\)b, \(\mu\)s, \(\Delta\)b, \(\Delta\)s}.

Details

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.

The function implements an extension of the algorithm of Cheng and Lai (2021) . In their paper, the authors assume that the probability of liquidity shock is the same in no-information, and information days, i.e., \(\theta\)=\(\theta'\), and use a procedure similar to that of Yan and Zhang (2012) to generate 64 initial parameter sets. The function implements an extension of their algorithm, by relaxing the assumption of equality of liquidity shock probabilities, and generates thereby 256 initial parameter sets for the unrestricted AdjPIN model.

References

Cheng T, Lai H (2021). “Improvements in estimating the probability of informed trading models.” Quantitative Finance, 21(5), 771-796.

Yan Y, Zhang S (2012). “An improved estimation method and empirical properties of the probability of informed trading.” Journal of Banking and Finance, 36(2), 454--467. ISSN 03784266.

Examples

# 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 transactions ('B') and seller-initiated
# transactions ('S') on that day. To know more, type ?dailytrades

xdata <- dailytrades

# Estimate the AdjPIN model using the algorithm of Cheng and Lai (2021)
# initial sets and the factorization of Ersan and Ghachem (2022b)

# Generate initial parameter sets
#---------------------------------
# Use initials_adjpin_cl() to generate 256 initial parameter sets using the
# algorithm of Cheng and Lai (2021).

initials_cl <- initials_adjpin_cl(xdata)
#> The function initials_adjpin_cl(...) has generated 256 initial parameter sets.
#> 
 To display the initial sets, store them in a variable or call (initials_adjpin_cl(...)). 
#> 
To hide these messages, set the argument 'silent' to TRUE (silent = TRUE).
#> 

# Estimate the AdjPIN model
#---------------------------------
# Use adjpin() to estimate the Adjusted PIN model using custom initial
# parameter sets stored in the dataframe 'initials_cl'. We could have
# obtained the same estimation results directly by setting the argument
# 'initialsets' to "CL":  adjpin(xdata, initialsets="CL")

estimate <- adjpin(xdata, initialsets = initials_cl, verbose = FALSE)

# Display the estimated parameters

round(unlist(estimate@parameters), 3)
#>   alpha   delta   theta  thetap   eps.b   eps.s    mu.b    mu.s     d.b     d.s 
#>   0.733   0.136   0.063   0.636 337.167 335.982 599.124 871.185 912.750   0.383