def margin_error(data, sample_size): zscore = zScore(data) standardDeviation = standard_deviation(data) denominator = root(sample_size, 2) willMultiply = division(standardDeviation, denominator) marginOfError = product(zscore, willMultiply) return marginOfError
def samplesizeKnownPop(data, confidence, error): z = division(confidence, 2) ztable_value = normalProbabilityDensity(z) standardDeviation = standard_deviation(data) ztableTimesStandard = product(ztable_value, standardDeviation) nextStep = division(ztableTimesStandard, error) sample_size = power(nextStep, 2) return sample_size
def skewness(data): theMode = mode(data) meanMinusMode = mean(data) - theMode[0] standardDeviation = standard_deviation(data) skewnessCoefficient = division(meanMinusMode, standardDeviation) return skewnessCoefficient