Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fixed p-value for extreme case.
  • Loading branch information
dorx committed Aug 11, 2014
commit cafb3a773cb7efd1280c62dfc4749d0c23ec8e2b
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ private[stat] object ChiSqTest extends Logging {
throw new IllegalArgumentException("Chi-squared statistic undefined for input vectors due"
+ " to 0.0 values in both observed and expected.")
} else {
return new ChiSqTestResult(Double.PositiveInfinity, size - 1, Double.PositiveInfinity,
PEARSON.name, NullHypothesis.goodnessOfFit.toString)
return new ChiSqTestResult(0.0, size - 1, Double.PositiveInfinity, PEARSON.name,
NullHypothesis.goodnessOfFit.toString)
}
}
if (scale == 1.0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class HypothesisTestSuite extends FunSuite with LocalSparkContext {
val inf = Statistics.chiSqTest(observed, zeroExpected)
assert(inf.statistic === Double.PositiveInfinity)
assert(inf.degreesOfFreedom === 2)
assert(inf.pValue === Double.PositiveInfinity)
assert(inf.pValue === 0.0)
assert(inf.method === ChiSqTest.PEARSON.name)
assert(inf.nullHypothesis === ChiSqTest.NullHypothesis.goodnessOfFit.toString)

Expand Down