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

TTestPowerAnalysis(OneSampleHypothesis) 
Creates a new TTestPowerAnalysis.
 
TTestPowerAnalysis(TwoSampleTTest) 
Creates a new TTestPowerAnalysis.

Name  Description  

Effect 
Gets or sets the effect size of the test.
(Inherited from BaseOneSamplePowerAnalysis.)  
Power 
Gets or sets the power of the test, also
known as the (1Beta error rate).
(Inherited from BaseOneSamplePowerAnalysis.)  
Samples 
Gets or sets the number of samples
considered in the test.
(Inherited from BaseOneSamplePowerAnalysis.)  
Size 
Gets or sets the significance level
for the test. Also known as alpha.
(Inherited from BaseOneSamplePowerAnalysis.)  
Tail 
Gets the test type.
(Inherited from BaseOneSamplePowerAnalysis.) 
Name  Description  

Clone 
Creates a new object that is a copy of the current instance.
(Inherited from BaseOneSamplePowerAnalysis.)  
ComputeEffect 
Computes the minimum detectable effect size for the test
considering the power given in Power, the
number of samples in Samples and the significance
level Size.
(Inherited from BaseOneSamplePowerAnalysis.)  
ComputePower  (Overrides BaseOneSamplePowerAnalysisComputePower.)  
ComputeSamples 
Computes recommended sample size for the test to attain
the power indicated in Power considering
values of Effect and Size.
(Inherited from BaseOneSamplePowerAnalysis.)  
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.)  
GetDiferentiableUnits 
Gets the minimum difference in the experiment units
to which it is possible to detect a difference.
(Inherited from BaseOneSamplePowerAnalysis.)  
GetEffectSize 
Estimates the number of samples necessary to attain the
required power level for the given effect size.
 
GetHashCode  Serves as the default hash function. (Inherited from Object.)  
GetSampleSize 
Estimates the number of samples necessary to attain the
required power level for the given effect size.
 
GetType  Gets the Type of the current instance. (Inherited from Object.)  
MemberwiseClone  Creates a shallow copy of the current Object. (Inherited from Object.)  
ToString 
Converts the numeric power of this test to its equivalent string representation.
(Inherited from BaseOneSamplePowerAnalysis.)  
ToString(String, IFormatProvider) 
Converts the numeric power of this test to its equivalent string representation.
(Inherited from BaseOneSamplePowerAnalysis.) 
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.)  
To(Type)  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 ExtensionMethods.) 
// When creating a power analysis, we have three things we can // change. We can always freely configure two of those things // and then ask the analysis to give us the third. var analysis = new TTestPowerAnalysis(OneSampleHypothesis.ValueIsDifferentFromHypothesis); // Those are: double e = analysis.Effect; // the test's minimum detectable effect size double n = analysis.Samples; // the number of samples in the test double p = analysis.Power; // the probability of committing a type2 error // Let's set the desired effect size and the // number of samples so we can get the power analysis.Effect = 0.2; // we would like to detect at least 0.2 std. dev. apart analysis.Samples = 60; // we would like to use at most 60 samples analysis.ComputePower(); // what will be the power of this test? double power = analysis.Power; // The power is going to be 0.33 (or 33%) // Let's set the desired power and the number // of samples so we can get the effect size analysis.Power = 0.8; // we would like to create a test with 80% power analysis.Samples = 60; // we would like to use at most 60 samples analysis.ComputeEffect(); // what would be the minimum effect size we can detect? double effect = analysis.Effect; // The effect will be 0.36 standard deviations. // Let's set the desired power and the effect // size so we can get the number of samples analysis.Power = 0.8; // we would like to create a test with 80% power analysis.Effect = 0.2; // we would like to detect at least 0.2 std. dev. apart analysis.ComputeSamples(); double samples = analysis.Samples; // We would need around 199 samples.