dataFrame.columns.stat — tTwoSamples()
Description
The tTwoSamples() method of the stat object performs a two-sample t-test between two selected columns.
Signature
dataFrame.columns(...columnNames).stat.tTwoSamples({ comparison: 'student' })Arguments
...columnNames( string[] )- The name of the columns from which to compute the t-test.
options(object)- T-test options.
Option
comparison(string)- The comparison method used to compute the t-test.
pairedstudent(default)student
Returns
stat(object)- A statistic object containing the t-test results.
T_stat(number)- The computed t-test statistic.
df(number)- The degrees of freedom of the test.
p_value(number)- The p-value associated with the test statistic.
confidence(number)- A confidence score computed as
1 - p_value.
Notes
- The method requires exactly two selected numeric columns.
- The null hypothesis states that both samples have the same mean.
- The
studentcomparison assumes equal variances between samples. - The
welchcomparison does not assume equal variances. - The
pairedcomparison requires paired observations and tests the mean difference between pairs. - Small p-values indicate evidence against the null hypothesis.
- Positive t-scores indicate that the first sample mean is greater than the second sample mean.
- Negative t-scores indicate that the first sample mean is lower than the second sample mean.
- The confidence score is calculated as
1 - p_value.
Example
// computes a t-test for 2 columns from a dataFrame
var stat = dataFrame.columns('groupA', 'groupB').stat.tTwoSamples();
// log the stat details
notebook.log(stat);