PairedTTest Class 
Namespace: Accord.Statistics.Testing
The PairedTTest type exposes the following members.
Name  Description  

PairedTTest 
Creates a new paired ttest.

Name  Description  

Confidence 
Gets the 95% confidence interval for the
ObservedDifference statistic.
 
CriticalValue 
Gets the critical value for the current significance level.
(Inherited from HypothesisTestTDistribution.)  
Hypothesis 
Gets the alternative hypothesis under test. If the test is
Significant, the null hypothesis can be rejected
in favor of this alternative hypothesis.
 
Mean1 
Gets the first sample's mean.
 
Mean2 
Gets the second sample's mean.
 
ObservedDifference 
Gets the observed mean difference between the two samples.
 
PValue 
Gets the Pvalue associated with this test.
(Inherited from HypothesisTestTDistribution.)  
SampleSize 
Gets the size of a sample.
Both samples have equal size.
 
Significant 
Gets whether the null hypothesis should be rejected.
(Inherited from HypothesisTestTDistribution.)  
Size 
Gets the significance level for the
test. Default value is 0.05 (5%).
(Inherited from HypothesisTestTDistribution.)  
StandardError 
Gets the standard error of the difference.
 
Statistic 
Gets the test statistic.
(Inherited from HypothesisTestTDistribution.)  
StatisticDistribution 
Gets the distribution associated
with the test statistic.
(Inherited from HypothesisTestTDistribution.)  
Tail 
Gets the test type.
(Inherited from HypothesisTestTDistribution.) 
Name  Description  

Equals  Determines whether the specified object is equal to the current object. (Inherited from Object.)  
Finalize  Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)  
GetConfidenceInterval 
Gets a confidence interval for the ObservedDifference
statistic within the given confidence level percentage.
 
GetHashCode  Serves as the default hash function. (Inherited from Object.)  
GetType  Gets the Type of the current instance. (Inherited from Object.)  
MemberwiseClone  Creates a shallow copy of the current Object. (Inherited from Object.)  
OnSizeChanged  Update event. (Overrides HypothesisTestTDistributionOnSizeChanged.)  
PValueToStatistic 
Converts a given pvalue to a test statistic.
(Overrides HypothesisTestTDistributionPValueToStatistic(Double).)  
StatisticToPValue 
Converts a given test statistic to a pvalue.
(Overrides HypothesisTestTDistributionStatisticToPValue(Double).)  
ToString 
Converts the numeric PValue of this test to its equivalent string representation.
(Inherited from HypothesisTestTDistribution.)  
ToString(String, IFormatProvider) 
Converts the numeric PValue of this test to its equivalent string representation.
(Inherited from HypothesisTestTDistribution.) 
Name  Description  

HasMethod 
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.)  
IsEqual  Compares two objects for equality, performing an elementwise comparison if the elements are vectors or matrices. (Defined by Matrix.)  
ToT  Overloaded.
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.)  
ToT  Overloaded.
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by Matrix.) 
The Paired Ttest can be used when the samples are dependent; that is, when there is only one sample that has been tested twice (repeated measures) or when there are two samples that have been matched or "paired". This is an example of a paired difference test.
References:
Suppose we would like to know the effect of a treatment (such as a new drug) in improving the wellbeing of 9 patients. The wellbeing is measured in a discrete scale, going from 0 to 10.
// To do so, we need to register the initial state of each patient // and then register their state after a given time under treatment. double[,] patients = { // before after // treatment treatment /* Patient 1.*/ { 0, 1 }, /* Patient 2.*/ { 6, 5 }, /* Patient 3.*/ { 4, 9 }, /* Patient 4.*/ { 8, 6 }, /* Patient 5.*/ { 1, 6 }, /* Patient 6.*/ { 6, 7 }, /* Patient 7.*/ { 3, 4 }, /* Patient 8.*/ { 8, 7 }, /* Patient 9.*/ { 6, 5 }, }; // Extract the before and after columns double[] before = patients.GetColumn(0); double[] after = patients.GetColumn(1); // Create the pairedsample Ttest. Our research hypothesis is // that the treatment does improve the patient's wellbeing. So // we will be testing the hypothesis that the wellbeing of the // "before" sample, the first sample, is "smaller" in comparison // to the "after" treatment group. PairedTTest test = new PairedTTest(before, after, TwoSampleHypothesis.FirstValueIsSmallerThanSecond); bool significant = test.Significant; // not significant double pvalue = test.PValue; // pvalue = 0.1650 double tstat = test.Statistic; // tstat = 1.0371