Perform1SampleTTest

Declaration: Perform1SampleTTest (data: TDoubleArray; RefMean: double; OneSided: boolean; var Mean, StdDev, tStatistic: double; var df: integer): double;
The function Perform1SampleTTest returns the probability associated with a 1-sample t test (probability which indicates the likelihood that the sample has come from an underlying population having the mean RefMean).

The array data contains the data, the parameter RefMean defines the mean 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 t test calculation:
Mean the mean of the sample
StdDev the standard deviation of the sample
tStatistic t statistic
df degrees of freedom
The function returns the following values:

≥0 ... the p-value associated with the t statistic
-1 ... the array data contains less than 2 data points
-2 ... the standard deviation of the sample is zero

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