Darwin Help

Back to Index

StatTest

Function StatTest - Test a statistical hypothesis

Calling Sequence  StatTest(test,data)
Parameters
NameTypeDescription

test stringIndicator which test should be done
data anythingdata used to test the hypothesis (type depends on test)
Return Type  TestStatResult
Synopsis This function tests several statistical hypothesis. The type of hypothesis to be tested is indicated via the first argument. Tests implemented so far:
 

ChiSquare One-dimensional Chi-square test of independence (cells are assumed equally-probably). "data" is a one-dimensional array of counts (non-negative integers). The data can also be a table or counts which must be indexed over the integers. Every non-zero entry of the table will be assumed an entry in the data.


ChiSquare Two-dimensional Chi-square test of independence (rows and columns are assumed independent). "data" is a two-dimensional array of counts (non-negative integers). The data can also be a table of counts which must be indexed over pairs of integers (lists of two integers). Every non-zero entry of the table will be assumed an entry in the data.


Independence Two arrays of (any type of) data are grouped to test their independence. The most significant Chi-square test is reported.


FriedmanRafsky Tests whether two samples, usually multivariates, come from the same distribution. Each sample must be inputed as a matrix in which each column is a sample.


G One-dimensional G test of independence (cells are assumed equally-probably). This is an instance of the likelihood ratio test applied to a list of equiprobable events. "data" is a one-dimensional array of counts (non-negative integers). The data can also be a table or counts which must be indexed over the integers. Every non-zero entry of the table will be assumed an entry in the data.


G Two-dimensional G test of independence (rows and columns are assumed independent). This is an instance of the likelihood ratio test applied to tableaux. "data" is a two-dimensional array of counts (non-negative integers). The data can also be a table of counts which must be indexed over pairs of integers (lists of two integers). Every non-zero entry of the table will be assumed an entry in the data.

 

  For each hypothesis an internal function will be called that computes the test statistic from the data, the p-value from Cumulative and the standardized deviation from CumulativeStd.

References HTMLC(Rice JA, Mathematical Statistics and Data Analysis, 2nd ed. chapter 13.4, p.489,Friedman, Rafsky (1979) "Multivariate Generalizations of the Wald-Wolfowitz and Smirnov Two-Sample Tests")
Examples
> StatTest( ChiSquare,[[1,2,3],[4,5,6],[7,8,9]] );
TestStatResult(ChiSquare,0.4688,0.9765,-1.9858,[[1, 2, 3], [4, 5, 6], [7, 8, 9]]
,Degrees_of_freedom = 4)
> StatTest( Independence, [A,B,B,B,B,A], [-1,3,4,3,4,-3] );
TestStatResult(ChiSquare,1.5000,0.2207,0.7699,[[2, 0], [2, 2]],Degrees_of_freedom = 1)
> StatTest( FriedmanRafsky, [[1,5],[2,-1],[1,3]], [[1,-1],[3,4]] );
TestStatResult(FriedmanRafsky,0.6547,0.5127,0.6547)
See also Cumulative,   CumulativeStd,   OutsideBounds,   ProbBallsBoxes,   ProbCloseMatches,   Rand,   Std_Score,   TestStatResult