Ejemplo n.º 1
0
def samplestand(data, sample_size):

    dev = 0

    sample = sampledata(data, sample_size)

    sample_values = len(sample)

    x_bar = mean()

    x = sample_values

    n = subtraction(sample_values, 1)

    for dev in sample:

        dev = subtraction(x, x_bar)

        square_x_bar = square(dev)

        add = addition(square_x_bar, square_x_bar)

        result = division(add, n)

    return squareroot(result)
def popstand(numbers):
    num_values = len(numbers)

    result = mean(numbers)
    total = 0
    for numb in numbers:
        result2 = subtraction(numb, result)
        sq = square(result2)
        total = addition(total, sq)
    return squareroot(division(num_values, total))
def confidence_interval(numbers):
    num_value = len(numbers)
    result = popstand(numbers)
    result2 = squareroot(num_value)
    sample_error = division(result2, result)
    margin_error = multiplication(
        1.96, sample_error)  # 1.96=z_value for 95% confidence interval
    result4 = addition(result, margin_error)
    result5 = subtraction(margin_error, result)
    return result4, result5
Ejemplo n.º 4
0
def stddev(nums):

    var = variance(nums)
    return squareroot(var)
Ejemplo n.º 5
0
 def sqrt(self, a):
     self.result = squareroot.squareroot(int(a))
     return self.result
Ejemplo n.º 6
0
 def squareroot(self, a):
     self.result = squareroot(a)
     return self.result
Ejemplo n.º 7
0
 def square_rt(self, a):
     self.result = squareroot(a)
     return round(float(self.result), 7)