initials_adjpin_rnd {PINstimation}R Documentation

AdjPIN random initial sets

Description

Generates random initial parameter sets to be used in the estimation of the AdjPIN model of Duarte and Young (2009).

Usage

initials_adjpin_rnd(data, restricted = list(), num_init = 20,
 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 (\mub=\mus). 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', \epsilonb=\epsilons, and \Deltab=\Deltas. If the value of the argument restricted is the empty list (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().

num_init

An integer corresponds to the number of initial parameter sets to be generated. The default value is 20.

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.

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 buy rate parameters {\epsilonb, \mub, \Deltab} are randomly generated from the interval (minB, maxB), where minB (maxB) is the smallest (largest) value of buys in the dataset, under the condition that \epsilonb+\mub+\Deltab< maxB. Analogously, the sell rate parameters {\epsilons, \mus, \Deltas} are randomly generated from the interval (minS, maxS), where minS (maxS) is the smallest(largest) value of sells in the dataset, under the condition that \epsilons+\mus+\Deltas < maxS.

Value

Returns a dataframe of numerical vectors of ten elements {\alpha, \delta, \theta, \theta', \epsilonb, \epsilons, \mub, \mus, \Deltab, \Deltas}.

References

Duarte J, Young L (2009). “Why is PIN priced?” Journal of Financial Economics, 91(2), 119–138. ISSN 0304405X.

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

xdata <- dailytrades

# Obtain a dataframe of 20 random initial parameters for the MLE of
# the AdjPIN model using the initials_adjpin_rnd().

initial.sets <- initials_adjpin_rnd(xdata, num_init = 20)

# Use the dataframe to estimate the AdjPIN model using the adjpin()
# function.

estimate <- adjpin(xdata, initialsets = initial.sets, verbose = FALSE)

# Show the value of adjusted PIN

show(estimate@adjpin)


[Package PINstimation version 0.1.2 Index]