Ejemplo n.º 1
0
def CochranSampleSize(data):

    p = 0.5
    q = 1 - p
    PQ = product(p, q)
    List = []
    List1 = []
    for i in MarginError(data):
        List.append(square(i))

    for i in Z_scores(z_values(data)):
        List1.append(square(i))
    i = 0
    n = []
    while i < len(List):
        n.append(round(product(List[i], PQ) / List1[i]))
        i += 1
    return n
Ejemplo n.º 2
0
def SampleSize_withStd(data):
    List = []
    List1 = []
    E = MarginError(data)
    K = mean_confidence_interval(data)
    for i in K:
        Z = i[1] / 2
        List.append(scipy.stats.norm.cdf(Z))
    i = 0
    while i < len(List):
        x = product(List[i], StdDevSample(data))
        y = round(division(x, E[i]))
        List1.append((square(y)))
        i += 1
    return List1
Ejemplo n.º 3
0
def Sample_Correlation(list1, list2):
    n = len(list1)

    avg_x = average(list1)
    avg_y = average(list2)
    rod = 0
    x2 = 0
    y2 = 0
    for i in range(n):
        x = subtraction(list1[i], avg_x)
        y = subtraction(list2[i], avg_y)
        rod += product(x, y)
        x2 += square(x)
        y2 += square(y)

    return rod / squareRoot(x2 * y2)
Ejemplo n.º 4
0
def SampleSize_withoutStd(data):
    E = MarginError(data)  # return a list
    p = 0.5
    q = 1 - p
    PQ = product(q, p)
    List = []
    List1 = []
    x = mean_confidence_interval(data)
    for i in x:
        Z = i[1] / 2
        List.append(scipy.stats.norm.cdf(Z))
    ME = []
    for i in E:
        ME.append(i / 2)
    i = 0
    while i < len(ME):
        ZE = List[i] / ME[i]
        x = round(square(ZE) * PQ)
        List1.append(x)
        i += 1
    return List1
Ejemplo n.º 5
0
 def Product(self, a, b):
     if typeFunction(a) == True and typeFunction(b) == True:
         self.result = product(a, b)
         return self.result