Record Class TestResult
java.lang.Object
java.lang.Record
cloud.opencode.base.math.stats.inference.TestResult
- Record Components:
testName- the name of the test / 检验名称statistic- the test statistic value / 检验统计量值pValue- the p-value / p 值degreesOfFreedom- the degrees of freedom (NaN if not applicable) / 自由度(不适用时为 NaN)
public record TestResult(String testName, double statistic, double pValue, double degreesOfFreedom)
extends Record
Immutable record holding the result of a statistical hypothesis test.
不可变记录,保存统计假设检验的结果
Contains the test name, test statistic, p-value, and degrees of freedom.
Use isSignificant(double) to check significance at a given alpha level.
包含检验名称、检验统计量、p 值和自由度。
使用 isSignificant(double) 在给定显著性水平下检查显著性。
- Since:
- JDK 25, opencode-base-math V1.0.3
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionTestResult(String testName, double statistic, double pValue, double degreesOfFreedom) Creates an instance of aTestResultrecord class. -
Method Summary
Modifier and TypeMethodDescriptiondoubleReturns the value of thedegreesOfFreedomrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanChecks whether the result is statistically significant at the default alpha = 0.05.booleanisSignificant(double alpha) Checks whether the result is statistically significant at the given alpha level.doublepValue()Returns the value of thepValuerecord component.doubleReturns the value of thestatisticrecord component.testName()Returns the value of thetestNamerecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
TestResult
Creates an instance of aTestResultrecord class.- Parameters:
testName- the value for thetestNamerecord componentstatistic- the value for thestatisticrecord componentpValue- the value for thepValuerecord componentdegreesOfFreedom- the value for thedegreesOfFreedomrecord component
-
-
Method Details
-
isSignificant
public boolean isSignificant(double alpha) Checks whether the result is statistically significant at the given alpha level. 检查结果在给定显著性水平下是否具有统计显著性- Parameters:
alpha- the significance level (e.g., 0.05) / 显著性水平(例如 0.05)- Returns:
- true if pValue < alpha / 如果 p 值小于 alpha 则返回 true
-
isSignificant
public boolean isSignificant()Checks whether the result is statistically significant at the default alpha = 0.05. 检查结果在默认显著性水平 alpha = 0.05 下是否具有统计显著性- Returns:
- true if pValue < 0.05 / 如果 p 值小于 0.05 则返回 true
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
testName
-
statistic
-
pValue
-
degreesOfFreedom
public double degreesOfFreedom()Returns the value of thedegreesOfFreedomrecord component.- Returns:
- the value of the
degreesOfFreedomrecord component
-