# Documentation of Data Measures

Here I provide a collection of various measures’ defnitions and source code in Python, SAS and/or other languages.

Some of the codes are used in production at my Research Data Services (RDS).

## Market Microstructure

### Variance Ratio Tests

#### Lo and MacKinlay (1988)

A simple test for the random walk hypothesis of prices and efficient market.

### Liquidity

#### Bid-Ask Spread

The bid-ask spread scaled by bid-ask midpoint.

#### Effective Spread

The effective spread is the difference between the natural logarithm of the actual transaction price and the natural logarithm of the midpoint prevailing at the time of the trade.

#### Realized Spread

The temporary component of the effective spread. It measures the revenue to liquidity providers assuming that the liquidity provider is able to close her position at the midpoint prevailing five minutes after the trade.

### Adverse Selection

#### Kyle’s Lambda

A measure of market impact cost from Kyle (1985), which can be interpreted as the cost of demanding a certain amount of liquidity over a given time period.

#### Price Impact

The permanent component of the effective spread. It measures the gross losses to the liquidity demanders due to adverse selection (Glosten and Harris (1988)).

#### Lin, Sanger and Booth (1995)

A spread decomposition model for estimating adverse selection.

#### Probability of Informed Trading (PIN)

The PIN of any asset captures the probability that a trade in that asset is initiated by an informed trader, developed in a series of papers, Easley, O’Hara, and co-authors (1992, 1996a, 1996b, 1997a, 1997b, 2002).

## Corporate Finance

### Discretionary Accruals

Jones (1991) model, modified Jones model, and Kothari et al (2005) model. Full description.