I am trying to do wilcoxonMatchedPairTest as given here:
import Data.Vector as V
import Statistics.Test.WilcoxonT
sampleA = [1.0,2.0,3.0,4.0,1.0,2.0,3.0,4]
sampleB = [2.0,4.0,5.0,5.0,3.0,4.0,5.0,6]
main = do
putStrLn "\nResult of wilcoxonMatchedPairTest: "
print (wilcoxonMatchedPairTest AGreater (Prelude.zip sampleA sampleB))
However, I am getting following error:
rnwilcox.hs:10:50: error:
• Couldn't match expected type ‘Data.Vector.Unboxed.Base.Vector
(a0, a0)’
with actual type ‘[(Double, Double)]’
• In the second argument of ‘wilcoxonMatchedPairTest’, namely
‘(Prelude.zip sampleA sampleB)’
In the first argument of ‘print’, namely
‘(wilcoxonMatchedPairTest AGreater (Prelude.zip sampleA sampleB))’
In a stmt of a 'do' block:
print
(wilcoxonMatchedPairTest AGreater (Prelude.zip sampleA sampleB))
Apparently, I need to unbox the vector here. I tried using #
as follows:
(# Prelude.zip sampleA sampleB #)
But it does not work. Where is the problem and how can it be solved? Thanks for your help.
You need to convert the list of 2-tuples to a
Vector
withfromList :: Unbox a => [a] -> Vector a
here from theData.Vector.Unboxed
package to create such a vector:or if you have two
Vector
s, you can usezip :: (Unbox a, Unbox b) => Vector a -> Vector b -> Vector (a, b)
to zip twoVector
s to aVector
of items:For the given sample data, this gives us: