Exemplo n.º 1
0
    def testWelchTest(self):
        """Verify computation of Welsh's t-test"""
        from plugins.groups.statisticalTests.Welch import Welch
        ttest = Welch(preferences)

        # ground truth found with t.test in R v2.13.0
        oneSided, twoSided, lowerCI, upperCI, effectSize, note = ttest.run(
            [5, 4, 6, 4, 3], [5, 2, 2, 5, 6, 7], [1, 1, 1, 1, 1],
            [1, 1, 1, 1, 1, 1], None, 0.95)
        self.assertAlmostEqual(oneSided, 0.5390501783)
        self.assertAlmostEqual(twoSided, 0.9218996432)
        self.assertAlmostEqual(lowerCI, -238.023177152)
        self.assertAlmostEqual(upperCI, 218.023177152)
        self.assertAlmostEqual(effectSize, -10.0)

        oneSided, twoSided, lowerCI, upperCI, effectSize, note = ttest.run(
            [3.4, 6.3, 5.3, 1.4, 6.3, 6.3], [3.5, 6.4, 5.2, 1.3, 6.4, 6.2],
            [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], None, 0.95)
        self.assertAlmostEqual(oneSided, 0.5)
        self.assertAlmostEqual(twoSided, 1.0)
        self.assertAlmostEqual(lowerCI, -262.6606201199)
        self.assertAlmostEqual(upperCI, 262.6606201199)
        self.assertAlmostEqual(effectSize, 0.0)

        oneSided, twoSided, lowerCI, upperCI, effectSize, note = ttest.run(
            [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
            [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],
            [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
            None, 0.95)
        self.assertAlmostEqual(oneSided, 0.9997146330)
        self.assertAlmostEqual(twoSided, 0.0005707338)
        self.assertAlmostEqual(lowerCI, -7120.16500998)
        self.assertAlmostEqual(upperCI, -2779.83499002)
        self.assertAlmostEqual(effectSize, -4950.0)
Exemplo n.º 2
0
	def testWelchTest(self):
		"""Verify computation of Welsh's t-test"""
		from plugins.groups.statisticalTests.Welch import Welch
		ttest = Welch(preferences)
		
		# ground truth found with t.test in R v2.13.0
		oneSided, twoSided, lowerCI, upperCI, effectSize, note = ttest.run([5,4,6,4,3],[5,2,2,5,6,7], [1,1,1,1,1], [1,1,1,1,1,1], None, 0.95)
		self.assertAlmostEqual(oneSided, 0.5390501783)
		self.assertAlmostEqual(twoSided, 0.9218996432)
		self.assertAlmostEqual(lowerCI, -238.023177152)
		self.assertAlmostEqual(upperCI, 218.023177152)
		self.assertAlmostEqual(effectSize, -10.0)
		
		oneSided, twoSided, lowerCI, upperCI, effectSize, note = ttest.run([3.4,6.3,5.3,1.4,6.3,6.3],[3.5,6.4,5.2,1.3,6.4,6.2], [1,1,1,1,1,1], [1,1,1,1,1,1], None, 0.95)
		self.assertAlmostEqual(oneSided, 0.5)
		self.assertAlmostEqual(twoSided, 1.0)
		self.assertAlmostEqual(lowerCI, -262.6606201199)
		self.assertAlmostEqual(upperCI, 262.6606201199)
		self.assertAlmostEqual(effectSize, 0.0)
		
		oneSided, twoSided, lowerCI, upperCI, effectSize, note = ttest.run([1,2,3,4,5,6,7,8,9,10],[10,20,30,40,50,60,70,80,90,100], [1,1,1,1,1,1,1,1,1,1], [1,1,1,1,1,1,1,1,1,1], None, 0.95)
		self.assertAlmostEqual(oneSided, 0.9997146330)
		self.assertAlmostEqual(twoSided, 0.0005707338)
		self.assertAlmostEqual(lowerCI, -7120.16500998)
		self.assertAlmostEqual(upperCI, -2779.83499002)
		self.assertAlmostEqual(effectSize, -4950.0)
Exemplo n.º 3
0
#=======================================================================