LK: Likelihood factorization of Lin and Ke (2011) - LK...

Description Usage Arguments Details Value Warning Author(s) References Examples

Description

The function calculates the likelihood factorization of Lin and Ke (2011) and computes paramaters for estimation of PIN value.

Usage

1
LK(data, fixed = c(FALSE, FALSE, FALSE, FALSE, FALSE))

Arguments

data

Data frame with 2 variables

fixed

Initial values for parameters in the following order: alpha, delta, mu, epsilon_b, epsilon_s

Details

In order to use LK's return in optimization functions, please omit second argument. With this way, LK will return a function instead of a value. Moreover, argument for data must be a data frame with 2 columns that contain numbers. Not any other type.

Value

LK_out

Returns an optim() object including parameter estimates for the likelihood factorization of Lin and Ke (2011)

Warning

This function does not handle NA values. Therefore the datasets should not contain any missing value

Author(s)

Duygu Celik and Murat Tinic

References

Lin, H.W.W. and Ke, W.C. A computing bias in estimating the probability of informed trading. Journal of Financial Markets, 14(4), pp.625-640, 2011.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
  # Sample Data
  #   Buy Sell 
  #1  350  382  
  #2  250  500  
  #3  500  463  
  #4  552  550  
  #5  163  200  
  #6  345  323  
  #7  847  456  
  #8  923  342  
  #9  123  578  
  #10 349  455 
  
  Buy<-c(350,250,500,552,163,345,847,923,123,349)
  Sell<-c(382,500,463,550,200,323,456,342,578,455)
  data=cbind(Buy,Sell)
  
  # Initial parameter values
  # par0 = (alpha, delta, mu, epsilon_b, epsilon_s)
  par0 = c(0.5,0.5,300,400,500)
  
  # Call LK function
  LK_out = LK(data)
  model = optim(par0, LK_out, gr = NULL, method = c("Nelder-Mead"), hessian = FALSE)
  
  ## Parameter Estimates
  model$par[1] # Estimate for alpha
  # [1] 0.480277
  model$par[2] # Estimate for delta
  # [1] 0.830850
  model$par[3] # Estimate for mu
  # [1] 315.259805
  model$par[4] # Estimate for eb
  # [1] 296.862318
  model$par[5] # Estimate for es
  # [1] 434.3046
  
  ## Estimate for PIN 
  (model$par[1]*model$par[3])/((model$par[1]*model$par[3])+model$par[4]+model$par[5])
  # [1] 0.178391
  ####

Example output

Attaching package: 'InfoTrad'

The following object is masked from 'package:base':

    print

There were 31 warnings (use warnings() to see them)
[1] -118808167
[1] 210730213
[1] 441.6373
[1] 266.348
[1] 437.4163
[1] 1

InfoTrad documentation built on May 1, 2019, 10:24 p.m.