TestResult
data class TestResult(val testName: String, val statistic: Double, val pValue: Double, val degreesOfFreedom: Double = Double.NaN, val alternative: Alternative = Alternative.TWO_SIDED, val confidenceInterval: ConfidenceInterval? = null, val additionalInfo: Map<String, Double> = emptyMap())(source)
The result of a statistical hypothesis test.
Contains the test statistic, p-value, and optional additional information such as degrees of freedom and a confidence interval. Use isSignificant to quickly check whether the result is statistically significant at a given significance level.
Example:
val result = tTest(sample = doubleArrayOf(2.1, 2.5, 2.3, 2.8), mu = 2.0)
result.statistic // t-statistic value
result.pValue // p-value
result.isSignificant() // true/false at alpha = 0.05
result.confidenceInterval // (lower, upper) bounds for the estimated meanContent copied to clipboard
Constructors
Link copied to clipboard
constructor(testName: String, statistic: Double, pValue: Double, degreesOfFreedom: Double = Double.NaN, alternative: Alternative = Alternative.TWO_SIDED, confidenceInterval: ConfidenceInterval? = null, additionalInfo: Map<String, Double> = emptyMap())
Properties
Link copied to clipboard
a map of supplementary statistics (e.g. "mean", "standardError", "oddsRatio") that vary by test type. Defaults to an empty map.
Link copied to clipboard
the direction of the alternative hypothesis that was tested. Defaults to Alternative.TWO_SIDED.
Link copied to clipboard
the confidence interval for the estimated parameter, or null if not computed. Defaults to null.
Link copied to clipboard
the degrees of freedom for the test distribution, or Double.NaN if not applicable. Defaults to Double.NaN.