/usr/share/hyphy/ChartAddIns/Descriptive Statistics is in hyphy-common 2.2.7+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | if (NON_EMPTY_SELECTION)
{
count = Columns (SELECTED_CHART_DATA);
sum = 0;
sum2 = 0;
sum3 = 0;
sum4 = 0;
SELECTED_CHART_DATA = Transpose(SELECTED_CHART_DATA)%0;
data_min = SELECTED_CHART_DATA [0];
data_max = SELECTED_CHART_DATA [count-1];
data_25 = SELECTED_CHART_DATA [(count*0.025)$1];
data_975 = SELECTED_CHART_DATA [Min((count*0.975+0.5)$1,count-1)];
if (count%2)
{
median = SELECTED_CHART_DATA[count/2];
}
else
{
counter = count/2-1;
median = (SELECTED_CHART_DATA[counter]+SELECTED_CHART_DATA[counter+1])/2;
}
for (counter=0; counter < count; counter = counter+1)
{
term = SELECTED_CHART_DATA [counter];
sum = sum+term;
sum2 = sum2+term*term;
sum3 = sum3+term^3;
sum4 = sum4+term^4;
}
if (count > 1)
{
counter = (sum2-sum*sum/count)/(count-1);
if (count > 3)
{
sum4 = (-6*sum^4+12*count*sum^2*sum2-3(count-1)*count*sum2^2-4*count(count+1)*sum*sum3+count^2*(count+1)*sum4)/(count*(count-1)*(count-2)*(count-3));
sum4 = sum4/counter^2+3;
}
else
{
sum4 = 0;
}
if (count > 2)
{
sum3 = (2*sum^3-3*count*sum*sum2+count^2*sum3)/(count*(count-1)*(count-2))/Sqrt(counter^2);
}
else
{
sum3 = 0;
}
fprintf (stdout, "\nCount = ", count,
"\nMean = ", sum/count,
"\nMedian = ", median,
"\nVariance = ", counter,
"\nStd.Dev = ", Sqrt (counter),
"\nCOV = ", Sqrt (counter)*count/sum,
"\nSum = ", sum,
"\nSq. sum = ", sum2,
"\nSkewness = ", sum3,
"\nKurtosis = ", sum4,
"\nMin = ", data_min,
"\n2.5% = ", data_25,
"\n97.5% = ", data_975,
"\nMax = ", data_max,"\n\n");
}
else
{
fprintf (stdout, "\nCount = ", count,
"\nMean = ", sum/count,
"\nMedian = ", median,
"\nVariance = Inf",
"\nStd.Dev = Inf",
"\nCOV = Inf",
"\nSum = ", sum,
"\nSq. sum = ", sum2,
"\nMin = ", data_min,
"\nMax = ", data_max,"\n\n""\n\n");
}
}
else
{
NON_EMPTY_SELECTION = -1;
}
|