/usr/share/yacas/statistics.rep/hypothesystest.ys is in yacas 1.3.3-2.
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 | /*
Hypothesys testing routines
Andrei Zorine,2002 <zoav1@uic.nnov.ru>
*/
/* Stub: ChiSquare's CDF is computed as IncompleteGamma(x,dof/2)/Gamma(dof/2); */
100 # ChiSquareTest( observed'freqs_IsList, expected'freqs_IsList, estimated'params_IsInteger)
<--
[
Local( nominator, chi2, p'value, k, dof);
k:=Length(observed'freqs);
nominator:=(observed'freqs-expected'freqs)^2; //threading
chi2:=Sum(i,1,k,nominator[i]/(expected'freqs[i]));
dof := k-estimated'params-1; // degrees of freedom
p'value:=1-N(IncompleteGamma(chi2/2,dof/2)/Gamma(dof/2));
{ TestStatistics <- chi2 , P'value <- p'value,Atom("dof") <- dof};
];
100 # ChiSquareTest( observed'freqs_IsList,
expected'freqs_IsList) <-- ChiSquareTest( observed'freqs, expected'freqs, 0);
|