## How to calculate a statistical herding measure for financial data

Occasional Contributor
Posts: 9

# How to calculate a statistical herding measure for financial data

Hi good day everyone,

The LSV (1992) measure is as follows:

Thus far I believe I have been able to calculate P(i,t), using the below formula

and after much help, the sas code I used to find P(i,t):

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 Pit (keep=timePeriod ticker buyingClients totalClients herding);
buyingClients = 0; totalClients = 0;
do until(last.timePeriod);
set b;
by ticker timePeriod;
totalClients + (stvol ne 0);
end;
run;

I am stuck as to how to proceed from this point, any help given will be so much appreciated.

Thank you

A

Frequent Learner
Posts: 1

## Re: How to calculate a statistical herding measure for financial data

Did you figure it out? Would really appreciate if you could share the calculation with me.

Discussion stats