为什么数据构造函数不在此处的范围内

Why data constructor is not in scope here

我正在尝试按照提供的方式进行学生 T 检验 here

import Data.Vector as V
import Statistics.Test.StudentT
sampleA = V.fromList [1.0,2.0,3.0,4.0,1.0,2.0,3.0,4]
sampleB = V.fromList [2.0,4.0,5.0,5.0,3.0,4.0,5.0,6]
main = print $ StudentT sampleA sampleB SamplesDiffer

但是,我收到以下错误:

rnunttest.hs:8:16: error:
    Data constructor not in scope:
      StudentT :: Vector Double -> Vector Double -> PositionTest -> a0

问题出在哪里,如何解决?谢谢你的帮助。

我认为您必须将构造函数更改为 studentTTest

main = print $ studentTTest sampleA sampleB SamplesDiffer

你在这里犯了两个错误:

  1. 函数是studenT<b>Test</b>,不是StudentT,那是type的名字 构造函数;和
  2. 构造函数接受一个 PositionTest 并被两个向量愚弄。
import Data.Vector as V
import Statistics.Test.StudentT

sampleA = V.fromList [1.0,2.0,3.0,4.0,1.0,2.0,3.0,4]
sampleB = V.fromList [2.0,4.0,5.0,5.0,3.0,4.0,5.0,6]

main = print (studentTTest SamplesDiffer sampleA sampleB)

对于给定的样本数据,这给了我们:

Prelude V Statistics.Test.StudentT> main
Just (Test {testSignificance = mkPValue 1.351738152442984e-2, testStatistics = -2.8243130467507513, testDistribution = studentT 14.0})