public void TTestConstructorTest2()
{
// Example from Larson & Farber, Elementary Statistics: Picturing the world.
/*
* A random sample of 17 police officers in Brownsville has a mean annual
* income of $35,800 and a standard deviation of $7,800. In Greensville,
* a random sample of 18 police officers has a mean annual income of $35,100
* and a standard deviation of $7,375. Test the claim at a = 0.01 that the
* mean annual incomes in the two cities are not the same. Assume the
* population variances are equal.
*/
double mean1 = 35800;
double stdDev1 = 7800;
double var1 = stdDev1 * stdDev1;
int n1 = 17;
double mean2 = 35100;
double stdDev2 = 7375;
double var2 = stdDev2 * stdDev2;
int n2 = 18;
TwoSampleTTest test = new TwoSampleTTest(mean1, var1, n1, mean2, var2, n2,
assumeEqualVariances: true,
alternate: TwoSampleHypothesis.ValuesAreDifferent);
Assert.AreEqual(33, test.DegreesOfFreedom);
Assert.AreEqual(2564.92, test.StandardError, 1e-3);
Assert.AreEqual(0.273, test.Statistic, 1e-3);
test.Size = 0.01;
Assert.IsFalse(test.Significant);
}