Author rhettinger
Recipients Christian.Kleineidam, aisaac, davin, dkorchem, madison.may, mark.dickinson, neil.g, pitrou, python-dev, rhettinger, serhiy.storchaka, tim.peters, westley.martinez, xksteven
Date 2016-09-27.05:01:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1474952511.0.0.750174936794.issue18844@psf.upfronthosting.co.za>
In-reply-to
Content
###################################################################
# 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]))
History
Date User Action Args
2016-09-27 05:01:51rhettingersetrecipients: + rhettinger, tim.peters, mark.dickinson, pitrou, aisaac, westley.martinez, python-dev, serhiy.storchaka, neil.g, madison.may, dkorchem, Christian.Kleineidam, davin, xksteven
2016-09-27 05:01:50rhettingersetmessageid: <1474952511.0.0.750174936794.issue18844@psf.upfronthosting.co.za>
2016-09-27 05:01:50rhettingerlinkissue18844 messages
2016-09-27 05:01:50rhettingercreate