I wrote an article in the November 2015 issue of MSDN Magazine titled “The T-Test using C#”. See https://msdn.microsoft.com/en-us/magazine/mt620016.aspx.
The goal of a t-test is to determine whether the means (averages) of two sets of numbers are equal in situations where you only have samples of the two sets. The idea is best explained by example. Suppose you’re investigating the mathematical ability of high school males and females in a large school district. The ability test is expensive and time-consuming so you can’t give the test to all the students. Instead, you randomly select a sample of 10 males and 10 females and give them the math test. From the sample results you can perform a t-test to infer whether there’s evidence that the true average score of all the males is equal to the true average score of all the females.
There are many standalone tools, including Excel, which can perform a t-test. But if you want to integrate t-test functionality directly into a software system, using standalone tools can be awkward or impossible, and may involve copyright or other legal issues. My article explains how to perform a t-test using raw (no external libraries) C# code.
There are several forms of the t-test. Perhaps the most common is called the Student t-test. The demo uses an improved variation called the Welch t-test. The Welch t-test is superior to the more common Student t-test in most scenarios. The Student t-test generally requires an equal number of data points in each of the two sample datasets, and requires that the variances of the two samples be approximately equal. The Welch t-test can work with unequal sample sizes and is robust even when sample variances differ.