Documentation
¶
Overview ¶
Package hypothesis provides statistical hypothesis tests.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ANOVAResult ¶
type ANOVAResult struct {
FStatistic float64 // F-statistic
PValue float64 // p-value
DFBetween int // degrees of freedom between groups
DFWithin int // degrees of freedom within groups
}
ANOVAResult contains the results of an ANOVA test.
func OneWayANOVA ¶
func OneWayANOVA(groups ...[]float64) ANOVAResult
OneWayANOVA performs a one-way ANOVA test. Tests whether the means of multiple groups differ.
type ChiSquareResult ¶
type ChiSquareResult struct {
Statistic float64 // chi-square statistic
PValue float64 // p-value
DF int // degrees of freedom
}
ChiSquareResult contains the results of a chi-square test.
func ChiSquare ¶
func ChiSquare(observed, expected [][]float64) ChiSquareResult
ChiSquare performs a chi-square test for independence. observed and expected are contingency tables (2D slices).
func ChiSquareGOF ¶
func ChiSquareGOF(observed, expected []float64) ChiSquareResult
ChiSquareGOF performs a chi-square goodness-of-fit test. Tests whether the observed frequencies match the expected frequencies.
func ChiSquareIndependence ¶
func ChiSquareIndependence(observed [][]float64) (ChiSquareResult, error)
ChiSquareIndependence performs a chi-square test of independence from a contingency table. Calculates expected frequencies automatically from observed data.
type TTestResult ¶
type TTestResult struct {
Statistic float64 // t-statistic
PValue float64 // p-value
DF int // degrees of freedom
}
TTestResult contains the results of a t-test.
func TTest ¶
func TTest(sample []float64, mu float64) TTestResult
TTest performs a one-sample t-test. Tests whether the sample mean differs from the population mean mu.
func TTest2Sample ¶
func TTest2Sample(sample1, sample2 []float64, equalVar bool) TTestResult
TTest2Sample performs a two-sample t-test (independent samples). Tests whether the means of two samples differ. equalVar: if true, assumes equal variances (pooled test)
func TTestPaired ¶
func TTestPaired(sample1, sample2 []float64) TTestResult
TTestPaired performs a paired t-test. Tests whether the mean difference between paired samples is zero.