Java Doc for TTestImpl.java in  » Science » Apache-commons-math-1.1 » org » apache » commons » math » stat » inference » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Science » Apache commons math 1.1 » org.apache.commons.math.stat.inference 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.commons.math.stat.inference.TTestImpl

TTestImpl
public class TTestImpl implements TTest(Code)
Implements t-test statistics defined in the TTest interface.

Uses commons-math org.apache.commons.math.distribution.TDistribution implementation to estimate exact p-values.
version:
   $Revision: 165583 $ $Date: 2005-05-01 22:14:49 -0700 (Sun, 01 May 2005) $




Constructor Summary
public  TTestImpl()
     Default constructor.

Method Summary
protected  doubledf(double v1, double v2, double n1, double n2)
     Computes approximate degrees of freedom for 2-sample t-test.
protected  DistributionFactorygetDistributionFactory()
     Gets a DistributionFactory to use in creating TDistribution instances.
public  doublehomoscedasticT(double[] sample1, double[] sample2)
     Computes a 2-sample t statistic, under the hypothesis of equal subpopulation variances.
public  doublehomoscedasticT(StatisticalSummary sampleStats1, StatisticalSummary sampleStats2)
     Computes a 2-sample t statistic, comparing the means of the datasets described by two StatisticalSummary instances, under the assumption of equal subpopulation variances.
protected  doublehomoscedasticT(double m1, double m2, double v1, double v2, double n1, double n2)
     Computes t test statistic for 2-sample t-test under the hypothesis of equal subpopulation variances.
public  doublehomoscedasticTTest(double[] sample1, double[] sample2)
     Returns the observed significance level, or p-value, associated with a two-sample, two-tailed t-test comparing the means of the input arrays, under the assumption that the two samples are drawn from subpopulations with equal variances. To perform the test without the equal variances assumption, use TTestImpl.tTest(double[],double[]) .

The number returned is the smallest significance level at which one can reject the null hypothesis that the two means are equal in favor of the two-sided alternative that they are different.

public  booleanhomoscedasticTTest(double[] sample1, double[] sample2, double alpha)
     Performs a two-sided t-test evaluating the null hypothesis that sample1 and sample2 are drawn from populations with the same mean, with significance level alpha, assuming that the subpopulation variances are equal.
public  doublehomoscedasticTTest(StatisticalSummary sampleStats1, StatisticalSummary sampleStats2)
     Returns the observed significance level, or p-value, associated with a two-sample, two-tailed t-test comparing the means of the datasets described by two StatisticalSummary instances, under the hypothesis of equal subpopulation variances.
protected  doublehomoscedasticTTest(double m1, double m2, double v1, double v2, double n1, double n2)
     Computes p-value for 2-sided, 2-sample t-test, under the assumption of equal subpopulation variances.
public  doublepairedT(double[] sample1, double[] sample2)
     Computes a paired, 2-sample t-statistic based on the data in the input arrays.
public  doublepairedTTest(double[] sample1, double[] sample2)
     Returns the observed significance level, or p-value, associated with a paired, two-sample, two-tailed t-test based on the data in the input arrays.

The number returned is the smallest significance level at which one can reject the null hypothesis that the mean of the paired differences is 0 in favor of the two-sided alternative that the mean paired difference is not equal to 0.

public  booleanpairedTTest(double[] sample1, double[] sample2, double alpha)
     Performs a paired t-test evaluating the null hypothesis that the mean of the paired differences between sample1 and sample2 is 0 in favor of the two-sided alternative that the mean paired difference is not equal to 0, with significance level alpha.

Returns true iff the null hypothesis can be rejected with confidence 1 - alpha.

public  doublet(double mu, double[] observed)
     Computes a t statistic given observed values and a comparison constant.
public  doublet(double mu, StatisticalSummary sampleStats)
     Computes a t statistic to use in comparing the mean of the dataset described by sampleStats to mu.
public  doublet(double[] sample1, double[] sample2)
     Computes a 2-sample t statistic, without the hypothesis of equal subpopulation variances.
public  doublet(StatisticalSummary sampleStats1, StatisticalSummary sampleStats2)
     Computes a 2-sample t statistic , comparing the means of the datasets described by two StatisticalSummary instances, without the assumption of equal subpopulation variances.
protected  doublet(double m, double mu, double v, double n)
     Computes t test statistic for 1-sample t-test.
protected  doublet(double m1, double m2, double v1, double v2, double n1, double n2)
     Computes t test statistic for 2-sample t-test.
public  doubletTest(double mu, double[] sample)
     Returns the observed significance level, or p-value, associated with a one-sample, two-tailed t-test comparing the mean of the input array with the constant mu.

The number returned is the smallest significance level at which one can reject the null hypothesis that the mean equals mu in favor of the two-sided alternative that the mean is different from mu.

public  booleantTest(double mu, double[] sample, double alpha)
     Performs a two-sided t-test evaluating the null hypothesis that the mean of the population from which sample is drawn equals mu.

Returns true iff the null hypothesis can be rejected with confidence 1 - alpha.

public  doubletTest(double mu, StatisticalSummary sampleStats)
     Returns the observed significance level, or p-value, associated with a one-sample, two-tailed t-test comparing the mean of the dataset described by sampleStats with the constant mu.

The number returned is the smallest significance level at which one can reject the null hypothesis that the mean equals mu in favor of the two-sided alternative that the mean is different from mu.

public  booleantTest(double mu, StatisticalSummary sampleStats, double alpha)
     Performs a two-sided t-test evaluating the null hypothesis that the mean of the population from which the dataset described by stats is drawn equals mu.

Returns true iff the null hypothesis can be rejected with confidence 1 - alpha.

public  doubletTest(double[] sample1, double[] sample2)
     Returns the observed significance level, or p-value, associated with a two-sample, two-tailed t-test comparing the means of the input arrays.

The number returned is the smallest significance level at which one can reject the null hypothesis that the two means are equal in favor of the two-sided alternative that they are different.

public  booleantTest(double[] sample1, double[] sample2, double alpha)
     Performs a two-sided t-test evaluating the null hypothesis that sample1 and sample2 are drawn from populations with the same mean, with significance level alpha.
public  doubletTest(StatisticalSummary sampleStats1, StatisticalSummary sampleStats2)
     Returns the observed significance level, or p-value, associated with a two-sample, two-tailed t-test comparing the means of the datasets described by two StatisticalSummary instances.

The number returned is the smallest significance level at which one can reject the null hypothesis that the two means are equal in favor of the two-sided alternative that they are different.

public  booleantTest(StatisticalSummary sampleStats1, StatisticalSummary sampleStats2, double alpha)
     Performs a two-sided t-test evaluating the null hypothesis that sampleStats1 and sampleStats2 describe datasets drawn from populations with the same mean, with significance level alpha.
protected  doubletTest(double m, double mu, double v, double n)
     Computes p-value for 2-sided, 1-sample t-test.
protected  doubletTest(double m1, double m2, double v1, double v2, double n1, double n2)
     Computes p-value for 2-sided, 2-sample t-test.

Does not assume subpopulation variances are equal.



Constructor Detail
TTestImpl
public TTestImpl()(Code)
Default constructor.




Method Detail
df
protected double df(double v1, double v2, double n1, double n2)(Code)
Computes approximate degrees of freedom for 2-sample t-test.
Parameters:
  v1 - first sample variance
Parameters:
  v2 - second sample variance
Parameters:
  n1 - first sample n
Parameters:
  n2 - second sample n approximate degrees of freedom



getDistributionFactory
protected DistributionFactory getDistributionFactory()(Code)
Gets a DistributionFactory to use in creating TDistribution instances. a distribution factory.



homoscedasticT
public double homoscedasticT(double[] sample1, double[] sample2) throws IllegalArgumentException(Code)
Computes a 2-sample t statistic, under the hypothesis of equal subpopulation variances. To compute a t-statistic without the equal variances hypothesis, use TTestImpl.t(double[],double[]) .

This statistic can be used to perform a (homoscedastic) two-sample t-test to compare sample means.

The t-statisitc is

   t = (m1 - m2) / (sqrt(1/n1 +1/n2) sqrt(var))

where n1 is the size of first sample; n2 is the size of second sample; m1 is the mean of first sample; m2 is the mean of second sample and var is the pooled variance estimate:

var = sqrt(((n1 - 1)var1 + (n2 - 1)var2) / ((n1-1) + (n2-1)))

with var1 the variance of the first sample and var2 the variance of the second sample.

Preconditions:

  • The observed array lengths must both be at least 2.

Parameters:
  sample1 - array of sample data values
Parameters:
  sample2 - array of sample data values t statistic
throws:
  IllegalArgumentException - if the precondition is not met



homoscedasticT
public double homoscedasticT(StatisticalSummary sampleStats1, StatisticalSummary sampleStats2) throws IllegalArgumentException(Code)
Computes a 2-sample t statistic, comparing the means of the datasets described by two StatisticalSummary instances, under the assumption of equal subpopulation variances. To compute a t-statistic without the equal variances assumption, use TTestImpl.t(StatisticalSummary,StatisticalSummary) .

This statistic can be used to perform a (homoscedastic) two-sample t-test to compare sample means.

The t-statisitc returned is

   t = (m1 - m2) / (sqrt(1/n1 +1/n2) sqrt(var))

where n1 is the size of first sample; n2 is the size of second sample; m1 is the mean of first sample; m2 is the mean of second sample and var is the pooled variance estimate:

var = sqrt(((n1 - 1)var1 + (n2 - 1)var2) / ((n1-1) + (n2-1)))

with var1 the variance of the first sample and var2 the variance of the second sample.

Preconditions:

  • The datasets described by the two Univariates must each contain at least 2 observations.

Parameters:
  sampleStats1 - StatisticalSummary describing data from the first sample
Parameters:
  sampleStats2 - StatisticalSummary describing data from the second sample t statistic
throws:
  IllegalArgumentException - if the precondition is not met



homoscedasticT
protected double homoscedasticT(double m1, double m2, double v1, double v2, double n1, double n2)(Code)
Computes t test statistic for 2-sample t-test under the hypothesis of equal subpopulation variances.
Parameters:
  m1 - first sample mean
Parameters:
  m2 - second sample mean
Parameters:
  v1 - first sample variance
Parameters:
  v2 - second sample variance
Parameters:
  n1 - first sample n
Parameters:
  n2 - second sample n t test statistic



homoscedasticTTest
public double homoscedasticTTest(double[] sample1, double[] sample2) throws IllegalArgumentException, MathException(Code)
Returns the observed significance level, or p-value, associated with a two-sample, two-tailed t-test comparing the means of the input arrays, under the assumption that the two samples are drawn from subpopulations with equal variances. To perform the test without the equal variances assumption, use TTestImpl.tTest(double[],double[]) .

The number returned is the smallest significance level at which one can reject the null hypothesis that the two means are equal in favor of the two-sided alternative that they are different. For a one-sided test, divide the returned value by 2.

A pooled variance estimate is used to compute the t-statistic. See TTestImpl.homoscedasticT(double[],double[]) . The sum of the sample sizes minus 2 is used as the degrees of freedom.

Usage Note:
The validity of the p-value depends on the assumptions of the parametric t-test procedure, as discussed here

Preconditions:

  • The observed array lengths must both be at least 2.

Parameters:
  sample1 - array of sample data values
Parameters:
  sample2 - array of sample data values p-value for t-test
throws:
  IllegalArgumentException - if the precondition is not met
throws:
  MathException - if an error occurs computing the p-value



homoscedasticTTest
public boolean homoscedasticTTest(double[] sample1, double[] sample2, double alpha) throws IllegalArgumentException, MathException(Code)
Performs a two-sided t-test evaluating the null hypothesis that sample1 and sample2 are drawn from populations with the same mean, with significance level alpha, assuming that the subpopulation variances are equal. Use TTestImpl.tTest(double[],double[],double) to perform the test without the assumption of equal variances.

Returns true iff the null hypothesis that the means are equal can be rejected with confidence 1 - alpha. To perform a 1-sided test, use alpha * 2. To perform the test without the assumption of equal subpopulation variances, use TTestImpl.tTest(double[],double[],double) .

A pooled variance estimate is used to compute the t-statistic. See TTestImpl.t(double[],double[]) for the formula. The sum of the sample sizes minus 2 is used as the degrees of freedom.

Examples:

  1. To test the (2-sided) hypothesis mean 1 = mean 2 at the 95% level, use
    tTest(sample1, sample2, 0.05).
  2. To test the (one-sided) hypothesis mean 1 < mean 2, at the 99% level, first verify that the measured mean of sample 1 is less than the mean of sample 2 and then use
    tTest(sample1, sample2, 0.02)

Usage Note:
The validity of the test depends on the assumptions of the parametric t-test procedure, as discussed here

Preconditions:

  • The observed array lengths must both be at least 2.
  • 0 < alpha < 0.5

Parameters:
  sample1 - array of sample data values
Parameters:
  sample2 - array of sample data values
Parameters:
  alpha - significance level of the test true if the null hypothesis can be rejected with confidence 1 - alpha
throws:
  IllegalArgumentException - if the preconditions are not met
throws:
  MathException - if an error occurs performing the test



homoscedasticTTest
public double homoscedasticTTest(StatisticalSummary sampleStats1, StatisticalSummary sampleStats2) throws IllegalArgumentException, MathException(Code)
Returns the observed significance level, or p-value, associated with a two-sample, two-tailed t-test comparing the means of the datasets described by two StatisticalSummary instances, under the hypothesis of equal subpopulation variances. To perform a test without the equal variances assumption, use TTestImpl.tTest(StatisticalSummary,StatisticalSummary) .

The number returned is the smallest significance level at which one can reject the null hypothesis that the two means are equal in favor of the two-sided alternative that they are different. For a one-sided test, divide the returned value by 2.

See TTestImpl.homoscedasticT(double[],double[]) for the formula used to compute the t-statistic. The sum of the sample sizes minus 2 is used as the degrees of freedom.

Usage Note:
The validity of the p-value depends on the assumptions of the parametric t-test procedure, as discussed here

Preconditions:

  • The datasets described by the two Univariates must each contain at least 2 observations.

Parameters:
  sampleStats1 - StatisticalSummary describing data from the first sample
Parameters:
  sampleStats2 - StatisticalSummary describing data from the second sample p-value for t-test
throws:
  IllegalArgumentException - if the precondition is not met
throws:
  MathException - if an error occurs computing the p-value



homoscedasticTTest
protected double homoscedasticTTest(double m1, double m2, double v1, double v2, double n1, double n2) throws MathException(Code)
Computes p-value for 2-sided, 2-sample t-test, under the assumption of equal subpopulation variances.

The sum of the sample sizes minus 2 is used as degrees of freedom.
Parameters:
  m1 - first sample mean
Parameters:
  m2 - second sample mean
Parameters:
  v1 - first sample variance
Parameters:
  v2 - second sample variance
Parameters:
  n1 - first sample n
Parameters:
  n2 - second sample n p-value
throws:
  MathException - if an error occurs computing the p-value




pairedT
public double pairedT(double[] sample1, double[] sample2) throws IllegalArgumentException, MathException(Code)
Computes a paired, 2-sample t-statistic based on the data in the input arrays. The t-statistic returned is equivalent to what would be returned by computing the one-sample t-statistic TTestImpl.t(double,double[]) , with mu = 0 and the sample array consisting of the (signed) differences between corresponding entries in sample1 and sample2.

Preconditions:

  • The input arrays must have the same length and their common length must be at least 2.

Parameters:
  sample1 - array of sample data values
Parameters:
  sample2 - array of sample data values t statistic
throws:
  IllegalArgumentException - if the precondition is not met
throws:
  MathException - if the statistic can not be computed do to aconvergence or other numerical error.



pairedTTest
public double pairedTTest(double[] sample1, double[] sample2) throws IllegalArgumentException, MathException(Code)
Returns the observed significance level, or p-value, associated with a paired, two-sample, two-tailed t-test based on the data in the input arrays.

The number returned is the smallest significance level at which one can reject the null hypothesis that the mean of the paired differences is 0 in favor of the two-sided alternative that the mean paired difference is not equal to 0. For a one-sided test, divide the returned value by 2.

This test is equivalent to a one-sample t-test computed using TTestImpl.tTest(double,double[]) with mu = 0 and the sample array consisting of the signed differences between corresponding elements of sample1 and sample2.

Usage Note:
The validity of the p-value depends on the assumptions of the parametric t-test procedure, as discussed here

Preconditions:

  • The input array lengths must be the same and their common length must be at least 2.

Parameters:
  sample1 - array of sample data values
Parameters:
  sample2 - array of sample data values p-value for t-test
throws:
  IllegalArgumentException - if the precondition is not met
throws:
  MathException - if an error occurs computing the p-value



pairedTTest
public boolean pairedTTest(double[] sample1, double[] sample2, double alpha) throws IllegalArgumentException, MathException(Code)
Performs a paired t-test evaluating the null hypothesis that the mean of the paired differences between sample1 and sample2 is 0 in favor of the two-sided alternative that the mean paired difference is not equal to 0, with significance level alpha.

Returns true iff the null hypothesis can be rejected with confidence 1 - alpha. To perform a 1-sided test, use alpha * 2

Usage Note:
The validity of the test depends on the assumptions of the parametric t-test procedure, as discussed here

Preconditions:

  • The input array lengths must be the same and their common length must be at least 2.
  • 0 < alpha < 0.5

Parameters:
  sample1 - array of sample data values
Parameters:
  sample2 - array of sample data values
Parameters:
  alpha - significance level of the test true if the null hypothesis can be rejected with confidence 1 - alpha
throws:
  IllegalArgumentException - if the preconditions are not met
throws:
  MathException - if an error occurs performing the test



t
public double t(double mu, double[] observed) throws IllegalArgumentException(Code)
Computes a t statistic given observed values and a comparison constant.

This statistic can be used to perform a one sample t-test for the mean.

Preconditions:

  • The observed array length must be at least 2.

Parameters:
  mu - comparison constant
Parameters:
  observed - array of values t statistic
throws:
  IllegalArgumentException - if input array length is less than 2



t
public double t(double mu, StatisticalSummary sampleStats) throws IllegalArgumentException(Code)
Computes a t statistic to use in comparing the mean of the dataset described by sampleStats to mu.

This statistic can be used to perform a one sample t-test for the mean.

Preconditions:

  • observed.getN() > = 2.

Parameters:
  mu - comparison constant
Parameters:
  sampleStats - DescriptiveStatistics holding sample summary statitstics t statistic
throws:
  IllegalArgumentException - if the precondition is not met



t
public double t(double[] sample1, double[] sample2) throws IllegalArgumentException(Code)
Computes a 2-sample t statistic, without the hypothesis of equal subpopulation variances. To compute a t-statistic assuming equal variances, use TTestImpl.homoscedasticT(double[],double[]) .

This statistic can be used to perform a two-sample t-test to compare sample means.

The t-statisitc is

   t = (m1 - m2) / sqrt(var1/n1 + var2/n2)

where n1 is the size of the first sample n2 is the size of the second sample; m1 is the mean of the first sample; m2 is the mean of the second sample; var1 is the variance of the first sample; var2 is the variance of the second sample;

Preconditions:

  • The observed array lengths must both be at least 2.

Parameters:
  sample1 - array of sample data values
Parameters:
  sample2 - array of sample data values t statistic
throws:
  IllegalArgumentException - if the precondition is not met



t
public double t(StatisticalSummary sampleStats1, StatisticalSummary sampleStats2) throws IllegalArgumentException(Code)
Computes a 2-sample t statistic , comparing the means of the datasets described by two StatisticalSummary instances, without the assumption of equal subpopulation variances. Use TTestImpl.homoscedasticT(StatisticalSummary,StatisticalSummary) to compute a t-statistic under the equal variances assumption.

This statistic can be used to perform a two-sample t-test to compare sample means.

The returned t-statisitc is

   t = (m1 - m2) / sqrt(var1/n1 + var2/n2)

where n1 is the size of the first sample; n2 is the size of the second sample; m1 is the mean of the first sample; m2 is the mean of the second sample var1 is the variance of the first sample; var2 is the variance of the second sample

Preconditions:

  • The datasets described by the two Univariates must each contain at least 2 observations.

Parameters:
  sampleStats1 - StatisticalSummary describing data from the first sample
Parameters:
  sampleStats2 - StatisticalSummary describing data from the second sample t statistic
throws:
  IllegalArgumentException - if the precondition is not met



t
protected double t(double m, double mu, double v, double n)(Code)
Computes t test statistic for 1-sample t-test.
Parameters:
  m - sample mean
Parameters:
  mu - constant to test against
Parameters:
  v - sample variance
Parameters:
  n - sample n t test statistic



t
protected double t(double m1, double m2, double v1, double v2, double n1, double n2)(Code)
Computes t test statistic for 2-sample t-test.

Does not assume that subpopulation variances are equal.
Parameters:
  m1 - first sample mean
Parameters:
  m2 - second sample mean
Parameters:
  v1 - first sample variance
Parameters:
  v2 - second sample variance
Parameters:
  n1 - first sample n
Parameters:
  n2 - second sample n t test statistic




tTest
public double tTest(double mu, double[] sample) throws IllegalArgumentException, MathException(Code)
Returns the observed significance level, or p-value, associated with a one-sample, two-tailed t-test comparing the mean of the input array with the constant mu.

The number returned is the smallest significance level at which one can reject the null hypothesis that the mean equals mu in favor of the two-sided alternative that the mean is different from mu. For a one-sided test, divide the returned value by 2.

Usage Note:
The validity of the test depends on the assumptions of the parametric t-test procedure, as discussed here

Preconditions:

  • The observed array length must be at least 2.

Parameters:
  mu - constant value to compare sample mean against
Parameters:
  sample - array of sample data values p-value
throws:
  IllegalArgumentException - if the precondition is not met
throws:
  MathException - if an error occurs computing the p-value



tTest
public boolean tTest(double mu, double[] sample, double alpha) throws IllegalArgumentException, MathException(Code)
Performs a two-sided t-test evaluating the null hypothesis that the mean of the population from which sample is drawn equals mu.

Returns true iff the null hypothesis can be rejected with confidence 1 - alpha. To perform a 1-sided test, use alpha * 2

Examples:

  1. To test the (2-sided) hypothesis sample mean = mu at the 95% level, use
    tTest(mu, sample, 0.05)
  2. To test the (one-sided) hypothesis sample mean < mu at the 99% level, first verify that the measured sample mean is less than mu and then use
    tTest(mu, sample, 0.02)

Usage Note:
The validity of the test depends on the assumptions of the one-sample parametric t-test procedure, as discussed here

Preconditions:

  • The observed array length must be at least 2.

Parameters:
  mu - constant value to compare sample mean against
Parameters:
  sample - array of sample data values
Parameters:
  alpha - significance level of the test p-value
throws:
  IllegalArgumentException - if the precondition is not met
throws:
  MathException - if an error computing the p-value



tTest
public double tTest(double mu, StatisticalSummary sampleStats) throws IllegalArgumentException, MathException(Code)
Returns the observed significance level, or p-value, associated with a one-sample, two-tailed t-test comparing the mean of the dataset described by sampleStats with the constant mu.

The number returned is the smallest significance level at which one can reject the null hypothesis that the mean equals mu in favor of the two-sided alternative that the mean is different from mu. For a one-sided test, divide the returned value by 2.

Usage Note:
The validity of the test depends on the assumptions of the parametric t-test procedure, as discussed here

Preconditions:

  • The sample must contain at least 2 observations.

Parameters:
  mu - constant value to compare sample mean against
Parameters:
  sampleStats - StatisticalSummary describing sample data p-value
throws:
  IllegalArgumentException - if the precondition is not met
throws:
  MathException - if an error occurs computing the p-value



tTest
public boolean tTest(double mu, StatisticalSummary sampleStats, double alpha) throws IllegalArgumentException, MathException(Code)
Performs a two-sided t-test evaluating the null hypothesis that the mean of the population from which the dataset described by stats is drawn equals mu.

Returns true iff the null hypothesis can be rejected with confidence 1 - alpha. To perform a 1-sided test, use alpha * 2.

Examples:

  1. To test the (2-sided) hypothesis sample mean = mu at the 95% level, use
    tTest(mu, sampleStats, 0.05)
  2. To test the (one-sided) hypothesis sample mean < mu at the 99% level, first verify that the measured sample mean is less than mu and then use
    tTest(mu, sampleStats, 0.02)

Usage Note:
The validity of the test depends on the assumptions of the one-sample parametric t-test procedure, as discussed here

Preconditions:

  • The sample must include at least 2 observations.

Parameters:
  mu - constant value to compare sample mean against
Parameters:
  sampleStats - StatisticalSummary describing sample data values
Parameters:
  alpha - significance level of the test p-value
throws:
  IllegalArgumentException - if the precondition is not met
throws:
  MathException - if an error occurs computing the p-value



tTest
public double tTest(double[] sample1, double[] sample2) throws IllegalArgumentException, MathException(Code)
Returns the observed significance level, or p-value, associated with a two-sample, two-tailed t-test comparing the means of the input arrays.

The number returned is the smallest significance level at which one can reject the null hypothesis that the two means are equal in favor of the two-sided alternative that they are different. For a one-sided test, divide the returned value by 2.

The test does not assume that the underlying popuation variances are equal and it uses approximated degrees of freedom computed from the sample data to compute the p-value. The t-statistic used is as defined in TTestImpl.t(double[],double[]) and the Welch-Satterthwaite approximation to the degrees of freedom is used, as described here. To perform the test under the assumption of equal subpopulation variances, use TTestImpl.homoscedasticTTest(double[],double[]) .

Usage Note:
The validity of the p-value depends on the assumptions of the parametric t-test procedure, as discussed here

Preconditions:

  • The observed array lengths must both be at least 2.

Parameters:
  sample1 - array of sample data values
Parameters:
  sample2 - array of sample data values p-value for t-test
throws:
  IllegalArgumentException - if the precondition is not met
throws:
  MathException - if an error occurs computing the p-value



tTest
public boolean tTest(double[] sample1, double[] sample2, double alpha) throws IllegalArgumentException, MathException(Code)
Performs a two-sided t-test evaluating the null hypothesis that sample1 and sample2 are drawn from populations with the same mean, with significance level alpha. This test does not assume that the subpopulation variances are equal. To perform the test assuming equal variances, use TTestImpl.homoscedasticTTest(double[],double[],double) .

Returns true iff the null hypothesis that the means are equal can be rejected with confidence 1 - alpha. To perform a 1-sided test, use alpha / 2

See TTestImpl.t(double[],double[]) for the formula used to compute the t-statistic. Degrees of freedom are approximated using the Welch-Satterthwaite approximation.

Examples:

  1. To test the (2-sided) hypothesis mean 1 = mean 2 at the 95% level, use
    tTest(sample1, sample2, 0.05).
  2. To test the (one-sided) hypothesis mean 1 < mean 2 at the 99% level, first verify that the measured mean of sample 1 is less than the mean of sample 2 and then use
    tTest(sample1, sample2, 0.02)

Usage Note:
The validity of the test depends on the assumptions of the parametric t-test procedure, as discussed here

Preconditions:

  • The observed array lengths must both be at least 2.
  • 0 < alpha < 0.5

Parameters:
  sample1 - array of sample data values
Parameters:
  sample2 - array of sample data values
Parameters:
  alpha - significance level of the test true if the null hypothesis can be rejected with confidence 1 - alpha
throws:
  IllegalArgumentException - if the preconditions are not met
throws:
  MathException - if an error occurs performing the test



tTest
public double tTest(StatisticalSummary sampleStats1, StatisticalSummary sampleStats2) throws IllegalArgumentException, MathException(Code)
Returns the observed significance level, or p-value, associated with a two-sample, two-tailed t-test comparing the means of the datasets described by two StatisticalSummary instances.

The number returned is the smallest significance level at which one can reject the null hypothesis that the two means are equal in favor of the two-sided alternative that they are different. For a one-sided test, divide the returned value by 2.

The test does not assume that the underlying popuation variances are equal and it uses approximated degrees of freedom computed from the sample data to compute the p-value. To perform the test assuming equal variances, use TTestImpl.homoscedasticTTest(StatisticalSummary,StatisticalSummary) .

Usage Note:
The validity of the p-value depends on the assumptions of the parametric t-test procedure, as discussed here

Preconditions:

  • The datasets described by the two Univariates must each contain at least 2 observations.

Parameters:
  sampleStats1 - StatisticalSummary describing data from the first sample
Parameters:
  sampleStats2 - StatisticalSummary describing data from the second sample p-value for t-test
throws:
  IllegalArgumentException - if the precondition is not met
throws:
  MathException - if an error occurs computing the p-value



tTest
public boolean tTest(StatisticalSummary sampleStats1, StatisticalSummary sampleStats2, double alpha) throws IllegalArgumentException, MathException(Code)
Performs a two-sided t-test evaluating the null hypothesis that sampleStats1 and sampleStats2 describe datasets drawn from populations with the same mean, with significance level alpha. This test does not assume that the subpopulation variances are equal. To perform the test under the equal variances assumption, use TTestImpl.homoscedasticTTest(StatisticalSummary,StatisticalSummary) .

Returns true iff the null hypothesis that the means are equal can be rejected with confidence 1 - alpha. To perform a 1-sided test, use alpha * 2

See TTestImpl.t(double[],double[]) for the formula used to compute the t-statistic. Degrees of freedom are approximated using the Welch-Satterthwaite approximation.

Examples:

  1. To test the (2-sided) hypothesis mean 1 = mean 2 at the 95%, use
    tTest(sampleStats1, sampleStats2, 0.05)
  2. To test the (one-sided) hypothesis mean 1 < mean 2 at the 99% level, first verify that the measured mean of sample 1 is less than the mean of sample 2 and then use
    tTest(sampleStats1, sampleStats2, 0.02)

Usage Note:
The validity of the test depends on the assumptions of the parametric t-test procedure, as discussed here

Preconditions:

  • The datasets described by the two Univariates must each contain at least 2 observations.
  • 0 < alpha < 0.5

Parameters:
  sampleStats1 - StatisticalSummary describing sample data values
Parameters:
  sampleStats2 - StatisticalSummary describing sample data values
Parameters:
  alpha - significance level of the test true if the null hypothesis can be rejected with confidence 1 - alpha
throws:
  IllegalArgumentException - if the preconditions are not met
throws:
  MathException - if an error occurs performing the test



tTest
protected double tTest(double m, double mu, double v, double n) throws MathException(Code)
Computes p-value for 2-sided, 1-sample t-test.
Parameters:
  m - sample mean
Parameters:
  mu - constant to test against
Parameters:
  v - sample variance
Parameters:
  n - sample n p-value
throws:
  MathException - if an error occurs computing the p-value



tTest
protected double tTest(double m1, double m2, double v1, double v2, double n1, double n2) throws MathException(Code)
Computes p-value for 2-sided, 2-sample t-test.

Does not assume subpopulation variances are equal. Degrees of freedom are estimated from the data.
Parameters:
  m1 - first sample mean
Parameters:
  m2 - second sample mean
Parameters:
  v1 - first sample variance
Parameters:
  v2 - second sample variance
Parameters:
  n1 - first sample n
Parameters:
  n2 - second sample n p-value
throws:
  MathException - if an error occurs computing the p-value




Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.