Message277487
###################################################################
# Flipping a biased coin
from collections import Counter
from random import choices
print(Counter(choices(range(2), [0.9, 0.1], k=1000)))
###################################################################
# Bootstrapping
'From a small statistical sample infer a 90% confidence interval for the mean'
# http://statistics.about.com/od/Applications/a/Example-Of-Bootstrapping.htm
from statistics import mean
from random import choices
data = 1, 2, 4, 4, 10
means = sorted(mean(choices(data, k=5)) for i in range(20))
print('The sample mean of {:.1f} has a 90% confidence interval from {:.1f} to {:.1f}'.format(
mean(data), means[1], means[-2])) |
|
Date |
User |
Action |
Args |
2016-09-27 05:01:51 | rhettinger | set | recipients:
+ rhettinger, tim.peters, mark.dickinson, pitrou, aisaac, westley.martinez, python-dev, serhiy.storchaka, NeilGirdhar, madison.may, dkorchem, Christian.Kleineidam, davin, xksteven |
2016-09-27 05:01:50 | rhettinger | set | messageid: <1474952511.0.0.750174936794.issue18844@psf.upfronthosting.co.za> |
2016-09-27 05:01:50 | rhettinger | link | issue18844 messages |
2016-09-27 05:01:50 | rhettinger | create | |
|