Пример #1
0
 def confidenceInterval(array, ci):
     df = len(array) - 1
     alpha = 1 - ci
     tval = stats.t.ppf(1 - alpha, df)
     stdev = Stats.standardDeviation(array)
     se = stdev / math.pow(len(array), .5)
     numerate = se * tval
     mean = Stats.mean(array)
     return [mean - numerate, mean + numerate]
Пример #2
0
    def known_pop_sample(data):
        zs = Stats.zscore(data)
        me = Sampling.marginError(data)
        sd = Stats.standardDeviation(data)

        value = (zs * sd) / me

        popSample = value**0.5

        return popSample
Пример #3
0
    def unknown_pop_sample(data, percent):
        zs = Stats.zscore(data)
        me = Sampling.marginError(data)
        p = percent
        q = 1 - p

        val = zs / me
        samplePop = val**0.5 * p * q

        return samplePop
Пример #4
0
 def Standarddeviation(self, a):
     self.Result = Stats.standardDeviation(a)
     return self.Result
Пример #5
0
 def Variance(self, a):
     self.Result = Stats.variance(a)
     return self.Result
 def test_Stats_Median(self):
     self.assertEqual(9.0, Stats.median(self.testData))
     self.assertEqual(9, Stats.median(self.testDataTwo))
Пример #7
0
 def ZScore(self, a):
     self.Result = Stats.zscore(a)
     return self.Result
Пример #8
0
 def SampleCorrelation(self, a):
     self.Result = Stats.correlationS(a)
     return self.Result
 def test_Stats_Correlation_Sample(self):
     arr = [self.testData, self.testDataTwo]
     self.assertEqual(0.9729647047577678, Stats.correlationS(arr))
 def test_Stats_Skew(self):
     self.assertEqual(0.003103728079018511, Stats.skew(self.testData))
 def test_Stats_Quartiles(self):
     result = Stats.quartiles(self.testData)
     self.assertEqual(4, result[0])
     self.assertEqual(9.0, result[1])
     self.assertEqual(15, result[2])
 def test_Stats_Standard_Deviation(self):
     self.assertEqual(6.109737219299115,
                      Stats.standardDeviation(self.testData))
 def test_Stats_Variance(self):
     self.assertEqual(37.328888888888876, Stats.variance(self.testData))
 def test_Stats_Mode(self):
     self.assertEqual(1, Stats.mode(self.testData))
Пример #15
0
 def Quartiles(self, a):
     self.Result = Stats.quartiles(a)
     return self.Result
Пример #16
0
 def Skewness(self, a):
     self.Result = Stats.skew(a)
     return self.Result
 def test_Stats_Correlation_Population(self):
     arr = [self.testData, self.testDataTwo]
     self.assertEqual(1.0065152118183804, Stats.correlationP(arr))
Пример #18
0
 def PopulationCorrelation(self, a):
     self.Result = Stats.correlationP(a)
     return self.Result
 def test_Stats_ZScore(self):
     self.assertEqual(-0.6983388177791585, Stats.zscore(self.testData)[0])
Пример #20
0
 def MeanAbsoluteDeviation(self, a):
     self.Result = Stats.meanDeviation(a)
     return self.Result
 def test_Stats_Mean_Deviation(self):
     self.assertEqual(5.484444444444445, Stats.meanDeviation(self.testData))
Пример #22
0
 def marginError(data):
     zs = Stats.zscore(data)
     sd = Stats.standardDeviation(data)
     margin = zs * sd
     return margin
Пример #23
0
 def Median(self, a):
     self.Result = Stats.median(a)
     return self.Result
Пример #24
0
 def Mode(self, a):
     self.Result = Stats.mode(a)
     return self.Result
 def test_Stats_Mean(self):
     self.assertEqual(9.266666666666667, Stats.mean(self.testData))