turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Stat Procs
- /
- How to conduct a Binomial Distribution Test on Fin...

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-15-2013 10:36 AM

Hello good day,

I am wondering how I should go about conducting a binomial test on financial herding ratios that have been calculated using the following code:

**data a (drop = market buyer seller tdate);****set TMP1.ttsetrades(where = (market = 'First Tier'));****timePeriod = intnx("WEEK", tdate, 0);****format timePeriod date9.;****run;**

**proc sort data=a; **

**by ticker timePeriod client;****run;**

**data b(drop=tvol sign);****do until (last.client);**** set a; **** by ticker timePeriod client;**** stvol = sum(stvol, tvol*sign);**** end;****run;**

**data herding(keep=timePeriod ticker buyingClients totalClients herding);****buyingClients = 0; totalClients = 0;****do until(last.timePeriod);**** set b; **** by ticker timePeriod;**** buyingClients + (stvol > 0);**** totalClients + (stvol ne 0);**

I came across an article that utilised the binomial testing to indicate whether the herding ratios found were statistically significant in indicating buy/sell herding within a stock.

The authors of the article infer that herding was "associated to the observation of a high value or low value of *h* by evaluating the probability to observe a number of buying firms equal or larger than the empirically detected one under the binomial null hypothesis." (Lillo et al. 2008)

They tested using a significance level of 5%, ratios that generated probability values less that 5% were inferred to indicate herding.

My research thus far in binomial testing has led me to the following code, if binomial testing on the ratios is possible can you tell me if the code below is correct, thanks.

**proc freq data=herding;**

** tables Herding / Binomial (p=0.50) alpha=0.05;**

** exact binomial;**

** weight freq;**

**run;**

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-15-2013 03:09 PM

I would use this code, provided I knew where the variable 'freq' in the weight statement came from. I don't see it in the data steps, and it is critical to the analysis.

Steve Denham

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-17-2013 03:03 PM

If the numerator of your fraction is BuyingClients and if the denominator of your fraction is TotalClients, the following PROC FREQ syntax may get you what you want: proc freq data=herding; tables BuyingClients / Binomial (p=0.50) alpha=0.05; exact binomial; weight TotalClients; run; However, note that TotalClients EXCLUDES those with STVOL=0. If a sizable proportion of your clients do have STVOL=0, then even though the number of TotalClients exceeds the number of BuyingClients, your results may be inaccurate.