学習環境
- Surface 3 (4G LTE)、Surface 3 タイプ カバー、Surface ペン(端末)
- Windows 10 Pro (OS)
- 数式入力ソフト(TeX, MathML): MathType
- MathML対応ブラウザ: Firefox、Safari
- MathML非対応ブラウザ(Internet Explorer, Microsoft Edge, Google Chrome...)用JavaScript Library: MathJax
- 参考書籍
Head First Statistics (Dawn Griffiths (著)、黒川 利明 (翻訳)、木下 哲也 (翻訳)、黒川 洋 (翻訳)、黒川 めぐみ (翻訳)、オライリージャパン)の7章(幾何分布、二項分布、ポアソン分布 - いろいろな離散確率分布)、長いエクササイズ(p. 320)を取り組んでみる。
長いエクササイズ(p. 320)
二項分布。
期待値はE(X) = 10 × 0.3 = 3
分散はVar(X) = 10 × 0.3 × 0.7 = 2.1。
ポアソン分布。
期待値はE(X) = 1。
分散はVar(X) = 1。
幾何分布。
期待値はE(X) = 1 / 0.2 = 0.05。
分散はVar(X) = (1 - 0.2) / 0.2^2 = 0.8 / 0.04 = 20。
コード(Emacs)
HTML5
<pre id="output0"></pre> <button id="run">run</button> <button id="clear0">clear</button> <script src="sample11.js"></script>
JavaScript
let pre0 = document.querySelector('#output0'),
btn0 = document.querySelector('#run'),
btn1 = document.querySelector('#clear0'),
p = (x) => pre0.textContent += x + '\n',
range = (start, end, step=1) => {
let res = [];
for (let i = start; i < end; i += step) {
res.push(i);
}
return res;
};
let factorial = (n) => range(1, n + 1).reduce((prev, next) => prev * next, 1);
let output = () => {
p('1.')
p(0.7 ** 10 + 10 * 0.3 * 0.7 ** 9 + 45 * 0.3 ** 2 * 0.7 ** 8);
p('2.');
p(Math.exp(-1));
p('3.');
p(0.2 + 0.8 * 0.2 + 0.8 ** 2 * 0.2);
};
btn0.onclick = output;
btn1.onclick = () => pre0.textContent = '';
output();
0 コメント:
コメントを投稿