DataLab is a compact statistics package aiming at exploratory data analysis. Please visit the DataLab Web site for more information....


Declaration: Perform1SampleChi2Test (data: TDoubleArray; RefStdDev: double; OneSided: boolean; var Mean, StdDev, Chi2Statistic: double; var df: integer): double;
The function Perform1SampleChi2Test returns the probability associated with a 1-sample chi-square test (probability which indicates the likelihood that the sample has come from an underlying population having the standard deviation RefStdDev).

The array data contains the data, the parameter RefStdDev defines the standard deviation of the population to be compared with. The parameter OneSided has to be TRUE for one-sided tests, or FALSE for two-sided tests. The function returns additional parameters obtained during the chi-square test calculation:

Mean the mean of the sample
StdDev the standard deviation of the sample
Chi2Statistic chi-square statistic
df degrees of freedom
The function returns the following values:

≥0 ... the p-value associated with the chi-square statistic
-1 ... the array data contains less than 3 data points
-2 ... the reference standard deviation is zero or negative

Hint: Some background information on the 1-sample t test can be found in the ebook "Fundamentals of Statistics"