estimate_pin: Estimates the Bayesian probability of informed trading

Description Usage Arguments Details Value References See Also Examples

Description

Calling estimate_pin() on trades data estimates the probability of informed trading from the compressed EKOP model presented in Grammig, Theissen and Zehnder (2015).

Usage

1
estimate_pin(pin_data, return_mcmc = FALSE, with_stephens = FALSE)

Arguments

pin_data

A vector of trades data (number of trades per day).

return_mcmc

A logical indicating, if MCMC parameter samples should be returned in addition to the final PIN estimates.

with_stephens

A logical indicating, if in addition to kmeans re- labeling also re-labeling via the algorithms from Stephens (1997a) and Stephens (1997b) should be applied.

Details

Internally this function uses the finmix package for estimation of the finite mixture parameters. The finmix package performs MCMC sampling for the parameters of the compressed EKOP model and computes three parameter estimates namely

Relabeling

The MCMC sampling uses a socalled random permutation algorithm to force the labels of the two distributions in the mixture to switch randomly between iterations. Label switching occurs naturally in estimation of finite mixture distributions and is documented in the literature. Random permutation tries not to eliminate label switching, but to bring it into a more controlled setting. As a result each MCMC parameter trace contains parameter values of the other trace. For this reason re-labeling is performed after sampling.

The finmix package offers three different re-labeling algorithms:

To offer the user more flexibility the function can also return the MCMC samples for further inspection. Setting return_mcmc to TRUE (default) returns also the MCMC traces.

Value

A data.frame() with PIN estimates, if return_mcmc is FALSE. Otherwise, a list containing the data.frame of PIN estimates together with a finmix::mcmcoutput (see mcmcoutput-class) object containing the MCMC traces of the component paramaters.

References

See Also

Examples

1
2
3
4
# Simulate trades data
trades_data <- simulate_ekop()
# Estimate the Bayesian PIN.
estimate_pin(trades_data$Trades)

simonsays1980/bayespin documentation built on Dec. 23, 2021, 2:25 a.m.