sample -> statistic -> information -> statistic -> decision
weight loss 90% guaranteed
Yes 11, No 4
H0: p = 0.9
H1: p < 0.9
critical regions
Null hypothesis
[python]
from math import sqrt
def mean(l);
return float(sum(l))/len(l)
def var(l):
m = mean(l)
return sum([(x-m)**2 for x in l])/len(l)
def factor(l):
return 1.96
def conf(l):
return factor(l) * sqrt(val(l)/ len(l))
def test(l, h):
m = mean(l)
c = conf(l)
return abs(h-m) <= c
l = [199, 200, 201, 202, 203, 204]
print mean(l)
print conf(l)
[/python]
95% confidence
candidate A 55
candidate B 45
1.96√p(1-p)/n = 1.96√.55-.44/100 = 9.75
Candidate A: 55 +/- 9.75