Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# st: using invnorm uniform to normalize my liquidity measure‏‏

 From Yori van der Kruijs To "statalist@hsphsun2.harvard.edu" Subject st: using invnorm uniform to normalize my liquidity measure‏‏ Date Fri, 17 May 2013 15:52:50 +0000

Dear Statalist,

For my master thesis I'm trying to replicate and extend the liquidity CAPM as used by Acharya and Pederson (2005).
In short, I need to construct a liquidity measure and liquidity portfolios to be able to investigate whether low liquidity stocks obtain higher expected returns than high liquidity stocks.

I use the liquidity measure from Amihud (2002) (it's called ILLIQ-measure)
It is very straightforward. ILLIQ of stock i in month t is:
ILLIQ(i,t)= (1/Number of valid observations in month)* Sum[ (ABS(Return(i,t,d))/Volume(i,t,d))]

The second part of the equation is the summation of absolute returns and dollar volume on day d in month t.

Note: They multiply ILLIQ by 1.000.000 (1 million) for analytic purposes.

In STATA I already constructed the ILLIQ measure itself, using this code:

bysort permno dm: egen ret_div_vol=sum(abs(ret/vol))
bysort permno dm: gen illiq=ret_div_vol*(1/validobs)*1000000

permno is the id variable, dm the monthly time variable (e.g. 2001m1, 2001m2 etc.)

Where I face problems:

They state that ILLIQ is measured in percent per dollar, while their model is in terms of "dollar cost per dollar invested".
They solve this problem by normalizing illiq, creating c(i,t):

c(i,t)=min(0.25 + 0.30* ILLIQ(i,t) * P(m,t-1), 30)

Ignore the P(m,t-1) factor here.

(My question:) I only need to know how to implement the mean (0.25) and standard deviation (0.30 * ILLIQ(i,t))
in STATA which returns the same value for a firm on different days in the same month.

Now I use:

bysort permno dm: gen normilliq=min(invnorm(uniform())*(0.30*illiq)+0.25,30)

This however creates values which are different for each observation of the same firm in the same month.
Since the ILLIQ measure creates values which are equal for a given firm for every day in a given month, the normalized measure should also give those results.

I tried using the standard "egen" function in combination with invnorm(uniform()), but I received this:
bysort permno dm: egen normilliq=invnorm(uniform())*(0.30*illiq)+0.25
unknown egen function invnorm()
Suggesting that this is not possible using "egen"

I am using Stata/SE 12.0 for Windows (64-bit x86-64)
Revision 24 Aug 2011

I hope this is clear enough!
Thank you very much for the help in advance

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/