init stat project
authorOleksandr Gavenko <gavenkoa@gmail.com>
Wed, 09 Mar 2016 21:23:23 +0200
changeset 0 328995b5b8fd
child 1 d1f59db03d01
init stat project
.dir-locals.el
Makefile
combinatoric.rst
index.rst
probability-discrete.rst
statistics.rst
tmpl/rst.css
tmpl/rst.tmpl.in
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.dir-locals.el	Wed Mar 09 21:23:23 2016 +0200
@@ -0,0 +1,5 @@
+;;; Directory Local Variables
+;;; For more information see (info "(emacs) Directory Variables")
+
+((rst-mode
+  (fill-column . 80)))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Makefile	Wed Mar 09 21:23:23 2016 +0200
@@ -0,0 +1,150 @@
+
+################################################################
+# Standard GNU Makefile settings.
+
+SHELL = /bin/sh
+export PATH := /bin:/usr/bin:${PATH}
+
+# Disable built in pattern rules.
+MAKEFLAGS += -r
+# Disable built in variables.
+MAKEFLAGS += -R
+# Disable built in suffix rules.
+.SUFFIXES:
+# Delete target file if command fails.
+.DELETE_ON_ERROR:
+# Default target.
+.DEFAULT_GOAL = all
+
+################################################################
+# Platform definition.
+
+host_os := linux
+ifneq '' '$(WINDIR)'
+  host_os := cygwin
+endif
+target_os := $(host_os)
+
+################################################################
+# Build tool definition/switches.
+
+RST2HTML := rst2html
+ifeq '$(host_os)' 'cygwin'
+  RST2HTML := rst2html.py
+endif
+
+RST_WARNING_FLAGS := --halt warning
+RST_RENDER_FLAGS := --strip-comments --embed-stylesheet --no-xml-declaration --math-output=HTML --initial-header-level=2
+RST_FLAGS := $(RST_WARNING_FLAGS) $(RST_RENDER_FLAGS)
+
+################################################################
+# Proj dirs/files.
+
+RST_FILES := $(wildcard *.rst)
+
+TMPL_DIR := tmpl
+
+HTML_DIR := dist/multi-html
+RST_HTML_FILES := $(patsubst %.rst,$(HTML_DIR)/%.html,$(RST_FILES))
+HTML_FILES := $(RST_HTML_FILES) $(HTML_DIR)/iframe.html
+
+################################################################
+# Deploy targets.
+
+WWW_SRV_NAME := defun.work
+WWW_SRV_USER := user
+HG_SRV_NAME := hg.defun.work
+HG_SRV_USER := user
+LOCAL_DIR := /srv/www/stat
+
+ifneq '' '$(filter deploy%,$(MAKECMDGOALS))'
+  $(shell rm -f $(HTML_DIR)/rst.tmpl)
+endif
+
+.PHONY: deploy
+deploy: deploy2defun-web deploy2defun-hg
+
+# Will be accessible via: http://stat.defun.work/
+.PHONY: deploy2defun-web
+deploy2defun-web: html
+	rsync --delete -avP -e ssh $(HTML_DIR)/ $(WWW_SRV_USER)@$(WWW_SRV_NAME):/srv/www/stat/
+
+.PHONY: deploy2defun-hg
+deploy2defun-hg:
+	hg push ssh://$(HG_SRV_USER)@$(HG_SRV_NAME)//srv/hg/tips || [ $$? = 1 ]
+
+.PHONY: deploy2local
+deploy2local: html
+	rsync --delete -avP $(HTML_DIR)/ $(LOCAL_DIR)
+
+################################################################
+# Build targets.
+
+.PHONY: all
+all:
+
+.PHONY: html
+html: $(HTML_FILES)
+
+$(HTML_DIR)/%.html: %.rst $(TMPL_DIR)/rst.css $(TMPL_DIR)/rst.tmpl $(MAKEFILE_LIST) | $(HTML_DIR)
+	$(RST2HTML) $(RST_FLAGS) --stylesheet=$(TMPL_DIR)/rst.css --template=$(TMPL_DIR)/rst.tmpl $*.rst $@
+
+$(HTML_DIR)/iframe.html: $(RST_FILES) $(MAKEFILE_LIST) | $(HTML_DIR)
+	{ \
+echo '<html><head>'; \
+echo '<meta charset="utf-8">'; \
+echo '<style>'; \
+echo 'a { text-decoration: none; color: hsl(240, 100%, 50%); }'; \
+echo 'a:hover { opacity: .5; }'; \
+echo '</style></head><body>'; \
+echo '<ul style="padding-left: 1em;">'; \
+for f in $(sort $(RST_FILES)); do \
+  n=$${f%.rst}; \
+  printf '<li><a target="_parent" href="%s.html">%s</a></li>\n' $$n $$n; \
+done; \
+echo '</ul>'; \
+echo '</body></html>'; \
+} >$@
+
+$(TMPL_DIR)/rst.tmpl: $(TMPL_DIR)/rst.tmpl.in $(MAKEFILE_LIST)
+	sed -e "s|{date}|$$(date +%F)|" -e "s|{rev}|$$(hg id -i)|"  <$< >$@
+
+################################################################
+# Init targets.
+
+$(HTML_DIR):
+	mkdir -p $@
+
+################################################################
+# Clean targets.
+
+.PHONY: distclean
+distclean: clean
+
+.PHONY: clean
+clean:
+	rm -r -f $(HTML_DIR)
+
+################################################################
+# Helper target.
+
+.PHONY: help
+help:
+	@echo Supported targets:
+	@sed -n -e '/^[[:alnum:]_-]*:/{s=^\(.*\):.*=  \1=;p;}' $(MAKEFILE_LIST)
+
+.PHONY: check-format-policy
+check-format-policy:
+	\
+for f in $(RST_FILES); do \
+  if grep '^.. -\*- coding: utf-8; -\*-' $$f >/dev/null; then :; else \
+    echo $$f:1:" Has no 'coding: utf-8' directive."; \
+  fi; \
+  if grep '^.. contents::' $$f >/dev/null; then :; else \
+    echo $$f:7:" Has no 'contents::' directive."; \
+  fi; \
+  if grep '^   :local:' $$f >/dev/null; then :; else \
+    echo $$f:7:" Has no ':local:' directive."; \
+  fi; \
+done
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/combinatoric.rst	Wed Mar 09 21:23:23 2016 +0200
@@ -0,0 +1,97 @@
+
+==============
+ Combinatoric
+==============
+.. contents::
+   :local:
+
+Permutation
+===========
+
+.. math:: perm(n) = n!
+
+Number of selecting m position from n places
+============================================
+
+It like a number of binary numbers length :math:`n` with :math:`m` ones.
+
+So by definition:
+
+.. math::
+
+  choose(n, 0) = 1
+  choose(n, n) = 1
+
+  choose(n, <0) = 0
+  choose(n, >n) = 0
+
+  choose(n, m) = choose(n-1, m-1) + choose(n-1, m)
+
+From this properties by induction:
+
+.. math:: choose(n, m) = n! / (n-m)! / m!
+
+Proof:
+
+.. math:: choose(1, m) = 1 = 1!/(1-m)!/m!, for m∈{0,1}
+
+Assume that we prove for :math:`n-1`, so:
+
+.. math::
+
+   choose(n, m) = choose(n-1, m-1) + choose(n-1, m)
+
+   = (n-1)!/(n-m)!/(m-1)! + (n-1)!/(n-1-m)!/m!
+
+   = (n-1)!/(n-1-m)!/(m-1)!·(1/(n-m) + 1/m)
+
+   = (n-1)!/(n-1-m)!/(m-1)!·(m+(n-m))/(n-m)/m = n!/(n-m)!/m!
+
+Partitions
+==========
+
+It like a number of numbers in n-base with 0 in m_1 positions, 1 in m_2
+positions, ..., (n-1) in m_n positions.
+
+.. math:: part(m_1, ..., m_n) = (∑_{i∈1..n} m_i)! / ∏_{i∈1..n} m_i!
+
+For :math:`n=2` it is a number of combinations:
+
+.. math:: part(m_1, m_2) = choose(m_1+m_2, m_2) = (m_1+m_2)! / (m_1!·m_2!)
+
+So:
+
+.. math::
+
+   part(m_1, m_2) = choose(m_1+m_2, m_2)
+
+   = choose(m_1+m_2 - 1, m_2) + choose(m_1+m_2 - 1, m_2 - 1)
+
+   = part(m_1 - 1, m_2) + part(m_1, m_2 - 1)
+
+Generalise thinking:
+
+.. math::
+
+   part(m_1, ..., m_n) = part(m_1 - 1, m_2, ..., m_n) + part(m_1, m_2 - 1, m_3, ..., m_n) + ... + part(m_1, ..., m_{n-1}, m_n - 1)
+
+Now we can prove partition formula by induction:
+
+.. math::
+
+   part(m_1, ..., m_n) = ∑_{i=1..n} part(..., m_{i-1}, m_i - 1, m_{i+1}, ...)
+
+   = ∑_{i=1..n} (m_i - 1 + ∑_{j=1..n, j≠i} m_j)! / (m_i - 1)! / ∏_{j=1..n, j≠i} m_j!
+
+   = ∑_{i=1..n} ((∑_{j=1..n} m_j) - 1)! / ∏_{j=1..n} (m_j - 1)! / ∏_{j=1..n,j≠i} m_j
+
+   = ((∑_{j=1..n} m_j) - 1)! / ∏_{j=1..n} (m_j - 1)! · ∑_{i=1..n} 1 / ∏_{j=1..n,j≠i} m_j
+
+   = ((∑_{j=1..n} m_j) - 1)! / ∏_{j=1..n} (m_j - 1)! · ∑_{i=1..n} m_i / ∏_{j=1..n} m_j
+
+   = ((∑_{j=1..n} m_j) - 1)! / ∏_{j=1..n} (m_j - 1)! / ∏_{j=1..n} m_j · ∑_{i=1..n} m_i
+
+   = ((∑_{j=1..n} m_j) - 1)! / ∏_{j=1..n} m_j! · ∑_{i=1..n} m_i
+
+   = (∑_{j=1..n} m_j)! / ∏_{j=1..n} m_j!
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/index.rst	Wed Mar 09 21:23:23 2016 +0200
@@ -0,0 +1,16 @@
+
+====================================
+ Notes on probability and statistic
+====================================
+.. contents::
+
+About
+=====
+
+This notes made by Oleksandr Gavenko during study of probability and statistic.
+
+License
+=======
+
+Public domain. Do whatever you want.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/probability-discrete.rst	Wed Mar 09 21:23:23 2016 +0200
@@ -0,0 +1,352 @@
+
+=============
+ Probability
+=============
+.. contents::
+   :local:
+
+.. role:: def
+   :class: def
+
+PMF
+===
+
+:def:`PMF` or :def:`probability mass function` or :def:`probability law` or
+:def:`probability discribuion` of discrete random variable is a function that
+for given number give probability of that value.
+
+To denote PMF used notations:
+
+.. math::
+
+   PMF(X = x) = P(X = x) = p_X(x) = P({ω ∈ Ω: X(ω) = x})
+
+where :math:`X` is a random variable on space :math:`Ω` of outcomes which mapped
+to real number via :math:`X(ω)`.
+
+Expected value
+==============
+
+:def:`Expected value` of PMF is:
+
+.. math::
+
+  E[X] = Σ_{ω∈Ω} Χ(x) * p(ω) = Σ_{x} x * p_X(x)
+
+We write :math:`a ≤ X ≤ b` for :math:`∀ ω∈Ω a ≤ X(ω) ≤ b`.
+
+If :math:`X ≥ 0` then :math:`E[X] ≥ 0`.
+
+if :math:`a ≤ X ≤ b` then :math:`a ≤ E[X] ≤ b`.
+
+If :math:`Y = g(X)` (:math:`∀ ω∈Ω Y(ω) = g(X(ω))`) then:
+
+.. math::
+
+  E[Y] = Σ_{x} g(x) * p_X(x)
+
+**Proof** TODO:
+
+.. math::
+
+  E[Y] = Σ_{y} y * p_Y(y)
+
+  = Σ_{y∈ℝ} y * Σ_{ω∈Ω: Y(ω)=y} p(ω)
+
+  = Σ_{y∈ℝ} y * Σ_{ω∈Ω: g(X(ω))=y} p(ω)
+
+  = Σ_{y∈ℝ} y * Σ_{x∈ℝ: g(x)=y} Σ_{ω∈Ω: X(ω) = x} p(ω)
+
+  = Σ_{y∈ℝ} y * Σ_{x∈ℝ: g(x)=y} p_X(x)
+
+  = Σ_{y∈ℝ} Σ_{x∈ℝ: g(x)=y} y * p_X(x)
+
+  = Σ_{x∈ℝ} Σ_{y∈ℝ: g(x)=y} y * p_X(x)
+
+  = Σ_{x} g(x) * p_X(x)
+
+.. math::
+
+  E[a*X + b] = a*E[X] + b
+
+Variance
+========
+
+:def:`Variance` is a:
+
+.. math::
+
+  var[X] = E[(X - E[X])^2] = E[X^2] - E^2[X]
+
+:def:`Standard deviation` is a:
+
+.. math::
+
+  σ_Χ = sqrt(var[X])
+
+Property:
+
+.. math::
+
+  var(a*X + b) = a²̇ · var[X]
+
+
+Total probability theorem
+=========================
+
+Let :math:`A_i ∩ A_j = ∅` for :math:`i ≠ j` and :math:`∑_i A_i = Ω`:
+
+.. math::
+
+  p_X(x) = Σ_i P(A_i)·p_{X|A_i}(x)
+
+Conditional PMF
+===============
+
+:def:`Conditional PMF` is:
+
+.. math::
+
+  p_{X|A}(x) = P(X=x | A)
+
+  E[X|A] = ∑_x x·p_{X|A}(x)
+
+Total expectation theorem
+=========================
+
+.. math::
+
+  E[X] = Σ_i P(A_i)·E[X|A_i]
+
+To prove theorem just multiply total probability theorem by :math:`x`.
+
+Joint PMF
+=========
+
+:def:`Joint PMF` of random variables :math:`X_1,...,X_n` is:
+
+.. math::
+
+   p_{X_1,...,X_n}(x_1,...,x_n) = P(AND_{x_1,...,x_n}: X_i = x_i)
+
+Properties:
+
+.. math::
+
+  E[X+Y] = E[X] + E[Y]
+
+Conditional PMF
+===============
+
+:def:`Conditional PMF` is:
+
+.. math::
+
+  p_{X|Y}(x|y) = P(X=x | Y=y) = P(X=x \& Y=y) / P(Y=y)
+
+So:
+
+.. math::
+
+  p_{X,Y}(x,y) = p_Y(y)·p_{X|Y}(x|y) = p_X(x)·p_{Y|X}(y|x)
+
+  p_{X,Y,Z}(x,y,z) = p_Y(y)·p_{Z|Y}(z|y)·p_{X|Y,Z}(x|y,z)
+
+  ∑_{x,y} p_{X,Y|Z}(x,y|z) = 1
+
+Conditional expectation of joint PMF
+====================================
+
+:def:`Conditional expectation of joint PMF` is:
+
+.. math::
+
+  E[X|Y=y] = ∑_x x·p_{X|Y}(x|y)
+
+  E[g(X)|Y=y] = ∑_x g(x)·p_{X|Y}(x|y)
+
+Total probability theorem for joint PMF
+=======================================
+.. math::
+
+  p_X(x) = ∑_y p_Y(y)·p_{X|Y}(x|y)
+
+Total expectation theorem for joint PMF
+=======================================
+.. math::
+
+  E[X] = ∑_y p_Y(y)·E[X|Y=y]
+
+Independence of r.v.
+====================
+
+r.v. :math:`X` and :math:`Y` is :def:`independent` if:
+
+.. math::
+
+  ∀_{x,y}: p_{X,Y}(x,y) = p_X(x)·p_Y(y)
+
+So if two r.v. are independent:
+
+.. math::
+
+  E[X·Y] = E[X]·E[Y]
+
+  var(X+Y) = var(X) + var(Y)
+
+Well known discrete r.v.
+========================
+
+Bernoulli random variable
+-------------------------
+
+:def:`Bernoulli random variable` with parameter :math:`p` is a random variable
+that have 2 outcomes denoted as :math:`0` and :math:`1` with probabilities:
+
+.. math::
+
+  p_X(0) = 1 - p
+
+  p_X(1) = p
+
+This random variable models a trial of experiment that result in success or
+failure.
+
+:def:`Indicator` of r.v. event :math:`A` is function::
+
+   I_A = 1 iff A occurs, else 0
+
+.. math::
+
+  P_{I_A} = p(I_A = 1) = p(A)
+
+  I_A*I_B = I_{A∩B}
+
+.. math::
+
+  E[bernoulli(p)] = 0*(1-p) + 1*p = p
+
+  var[bernoulli(p)] = E[bernoulli(p) - E[bernoulli(p)]]
+
+   = (0-p)²·(1-p) + (1-p)²·p = p²·(1-p) + (1 - 2p + p²)·p
+
+   = p² - p³ + p - 2·p² + p³ = p·(1-p)
+
+Discret uniform random variable
+-------------------------------
+
+:def:`Discret uniform random variable` is a variable with parameters :math:`a`
+and :math:`b` in sample space :math:`{x: a ≤ x ≤ b & x ∈ ℕ}` with equal
+probability of each possible outcome:
+
+.. math::
+
+  p_{unif(a,b)}(x) = 1 / (b-a+1)
+
+.. math::
+
+  E[unif(a,b)] = Σ_{a ≤ x ≤ b} x * 1/(b-a+1)
+  = 1/(b-a+1) * Σ_{a ≤ x ≤ b} x
+
+  = 1/(b-a+1) * (Σ_{a ≤ x ≤ b} a + Σ_{0 ≤ x ≤ b-a} x)
+
+  = 1/(b-a+1) * ((b-a+1)*a + (b-a)*(b-a+1)/2)
+
+  = a + (b-a)/2
+  = (b+a)/2
+
+
+.. math::
+
+  var[unif(a,b)] = E[unif²(a,b)] - E²[unif(a,b)]
+
+  = ∑_{a≤x≤b} x²/(b-a+1) - (b+a)²/4
+
+  = 1/(b-a+1)·(∑_{0≤x≤b} x² - ∑_{0≤x≤a-1} x²) - (b+a)²/4
+
+  = 1/(b-a+1)·(b+3·b²+2·b³ - (a-1)+3·(a-1)²+2·(a-1)³)/6 - (b+a)²/4
+
+  = (2·b² + 2·a·b + b + 2·a² - a)/6 - (b+a)²/4
+
+  = (b - a)·(b - a + 2) / 12
+
+.. NOTE::
+
+   From Maxima::
+
+     sum(i^2,i,0,n), simpsum=true;
+
+              2      3
+       n + 3 n  + 2 n
+       ---------------
+             6
+
+     factor(b+3*b^2+2*b^3 - (a-1)-3*(a-1)^2-2*(a-1)^3);
+
+                       2                  2
+       (b - a + 1) (2 b  + 2 a b + b + 2 a  - a)
+
+     factor((2*b^2 + 2*a*b + b + 2*a^2 - a)/6 - (b+a)^2/4), simp=true;
+
+       (b - a) (2 - a + b)
+       -------------------
+               12
+
+Binomial random variable
+------------------------
+
+:math:`Binomial random variable` is a r.v. with parameters :math:`n` (positive
+integer) and p from interval :math:`(0,1)` and sample space of positive integers
+from inclusive region :math:`[0, n]`:
+
+.. math::
+
+  p_{binom(n,p)}(x) = n!/(x!*(n-x)!) p^x p^{n-x}
+
+Binomial random variable models a number of success of :math:`n` independent
+trails of Bernoulli experimants.
+
+.. math::
+
+  E[binom(n,p)] = E[∑_{1≤x≤n} bernoulli(p)] = ∑_{1≤x≤n} E[bernoulli(p)] = n·p
+
+  var[binom(n,p)] = var[∑_{1≤x≤n} bernoulli(p)] = ∑_{1≤x≤n} var[bernoulli(p)] = n·p·(1-p)
+
+Geometric random variable
+-------------------------
+
+:def:`Geometric random variable` is a r.v. with parameter :math:`p` from
+half open interval :math:`(0,1]`, sample space is all positive numbers:
+
+.. math::
+
+  p_{geom(p)}(x) = p (1-p)^(x-1)
+
+This random variable models number of tosses of biased coin until first success.
+
+.. math::
+
+  E[geom(p)] = ∑_{x=1..∞} x·p·(1-p)^(x-1)
+
+  = p·∑_{x=1..∞} x·(1-p)^(x-1)
+
+  = p/(1-p)·∑_{x=0..∞} x·(1-p)^x
+
+  = p/(1-p)·(1-p)/(1-p - 1)² = p/p² = 1/p
+
+.. NOTE::
+
+   Maxima calculation::
+
+     load("simplify_sum");
+     simplify_sum(sum(k * x^k, k, 0, inf));
+       Is abs(x) - 1 positive, negative or zero?
+       negative;
+       Is x positive, negative or zero?
+       positive;
+       Is x - 1 positive, negative or zero?
+       negative;
+            x
+       ------------
+        2
+       x  - 2 x + 1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/statistics.rst	Wed Mar 09 21:23:23 2016 +0200
@@ -0,0 +1,160 @@
+
+============
+ Statistics
+============
+.. contents::
+   :local:
+
+.. role:: def
+   :class: def
+
+Markov inequality
+=================
+
+:def:`Markov inequality`: :math:`P(X ≥ a) ≤ E[P]/a` for all :math:`a > 0`.
+
+Chebyshev inequality
+====================
+
+:def:`Chebyshev inequality`: if :math:`X` is a random variable with mean
+:math:`μ` and variance :math:`σ²` then
+
+.. math::
+
+  P(|X-μ| ≥ c) ≤ σ²/c²
+
+for all :math:`c > 0`.
+
+Central limit theorem
+=====================
+
+:def:`Central limit theorem`: let :math:`X_1, ..., X_n, ...` be a sequence of
+independent identically distributed random variables with common mean :math:`μ`
+and variance :math:`σ²` and let:
+
+.. math::
+
+  Z_n = ((∑_{1≤i≤n} X_i) - n·μ) / (σ·sqrt(n))
+
+Then CDF of :math:`Z_n` converge to standard normal CDF:
+
+.. math::
+
+  Φ(z) = 1/(2·π)·∫_{(-∞;z]} exp(-x²/2) 𝑑x
+
+  lim_{n → ∞} P(Z_n ≤ z) = Φ(z)
+
+Null hypothesis
+===============
+
+:def:`Null hypothesis` a statement that the phenomenon being studied produces no
+effect or makes no difference, assumption that effect actually due to chance.
+
+p-value
+=======
+
+:def:`p-value` is the probability of the apparent effect under the null
+hypothesis.
+
+  https://en.wikipedia.org/wiki/P-value
+    Wikipedia page
+
+Significance level
+==================
+
+If the p-value is less than or equal to the chosen :def:`significance level`
+(:math:`α`), the test suggests that the observed data are inconsistent with the
+null hypothesis, so the null hypothesis should be rejected.
+
+Hypothesis testing
+==================
+
+:def:`Hypothesis testing` is process of interpretation of statistical
+significance of given null hypothesis based on observed p-value from sample with
+choosen significance level.
+
+After finishing hypothesis testing we should reject null hypothesis or fail to
+reject due to lack of enough evidence or ...
+
+Hypothesis testing only take into account:
+
+* that effect might be due to chance; that is, the difference might appear in a
+  random sample, but not in the general population
+
+But it doesn't cover cases:
+
+* The effect might be real; that is, a similar difference would be seen in the
+  general population.
+* The apparent effect might be due to a biased sampling process, so it would not
+  appear in the general population.
+* The apparent effect might be due to measurement errors.
+
+Asymptotic approximation
+========================
+
+CLT say that sample mean distribution is approximated by normal distribution.
+
+With fair enough number of samples approximation is quite good.
+
+So during hypothesis testing usually researcher makes assumption that is is safe
+to replace unknown distribution of means for independent and identicaly
+distributed individual samples with approximation.
+
+For really small number of samples Student distribution is used instead of
+normal distribution. But again it means that researcher made assumption and you
+may not agree with it, so it is your right to reject any subsequent decision
+based on "wrong" assumption.
+
+Type I error
+============
+
+:def:`Type I error` is the incorrect rejection of a true null hypothesis (a
+*false positive*).
+
+Type I error rate is at most :math:`α` (significant level).
+
+The p-value of a test is the maximum false positive risk you would take by
+rejecting the null hypothesis.
+
+Type II error
+=============
+
+:def:`Type II error` is failing to reject a false null hypothesis (a *false
+negative*).
+
+Probability of type II error usually called :math:`β`.
+
+Power
+=====
+
+:def:`Power` is a probability to reject null hypothesis when it's false. So
+power probability is :math:`1-β`.
+
+Confidence interval
+===================
+
+:def:`Confidence interval` 
+
+  https://en.wikipedia.org/wiki/Confidence_interval
+    Wikipedia page
+
+
+Question
+========
+
+What to do with null hypothesis in classical inference?
+
+I successfully shirked stat classes 10 years ago (last night reading help me
+actually to pass exam) and now when I take several Coursera stat classes I have
+difficulties with understanding **null hypothesis**. Somehow with unclear
+intuition I passed quizzes but want to understand subject.
+
+Suppose we have population and sample some data from population. Reasonable
+question: is some property of sample make evidence to be true on population?
+
+Statistic is a real number that can be derived from population or sample.
+Classical example is a mean value.
+
+We ask is it statistically significant that statistic of population is near to
+statistic of sample.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tmpl/rst.css	Wed Mar 09 21:23:23 2016 +0200
@@ -0,0 +1,151 @@
+html, body, iframe {
+    margin: 0px;
+    padding: 0px;
+}
+iframe {
+    overflow: hidden;
+}
+.document {
+    max-width: 800px;
+    margin: .5em auto;
+    padding-left: 190px;
+    padding-right: 10px;
+    overflow: hidden;
+}
+#sidebar { position: fixed; }
+iframe { border: none; }
+#sidebar, iframe {
+    top: 0;
+    left: 0;
+    width: 180px;
+    height: 100%;
+}
+@media (max-width: 780px) {
+    .document {
+        margin: 5px 10px 1em 10px;
+        padding: 0;
+    }
+    #sidebar { position: inherit; }
+    #sidebar, iframe {
+        width: 100%;
+        height: 7em;
+    }
+}
+
+.header {
+    font-size: 1.2em;
+    text-align: center;
+}
+.header.small {
+    font-size: 0.8em;
+}
+
+div.contents ul {
+    max-width: 600px;
+    margin: 0 auto;
+}
+div.contents ul ul {
+    margin-left: 1em;
+}
+
+a {
+    text-decoration:none;
+    color: hsl(240, 100%, 50%);
+}
+a:hover { opacity: .5; }
+h1 a {
+    color: hsla(0, 0%, 0%, .8);
+}
+h2 a, h3 a, h4 a, .contents a {
+    color: hsl(0, 100%, 25%);
+}
+h1 { text-align: center; }
+div > p:first-child:first-letter,
+h2 + p:first-letter,
+h3 + p:first-letter,
+h4 + p:first-letter,
+h5 + p:first-letter {
+    font-weight: bold;
+}
+
+blockquote {
+    margin: 1em 0;
+}
+ul, ol {
+    margin-left: 1em;
+    padding-left: 1em;
+}
+dl {
+    margin-left: 1em;
+}
+.formula {
+    padding: 0 .5em;
+    background-color: hsl(0, 10%, 95%);
+}
+div.formula {
+    border: 1px;
+    border-left-style: solid;
+    border-right-style: solid;
+    border-color: hsl(0, 100%, 25%);
+}
+.literal-block {
+    margin: 0 0 0 1em;
+    padding: 5px;
+    border: 1px;
+    border-style: solid;
+    border-color: hsl(0, 100%, 25%);
+    background-color: hsl(0, 10%, 95%);
+    overflow: auto;
+}
+tt.literal {
+    outline: 1px dotted orange;
+    padding: 1px;
+}
+table { border-collapse:collapse; margin-left:auto; margin-right:auto; }
+table, tr, td { padding: 3px; border: 1px dotted maroon; background-color: cornsilk; }
+
+pre.code.keyword, pre.code.tag {
+    color: blue;
+}
+pre.code.string, pre.code.preproc  {
+    color: green;
+}
+pre.code.name.decorator, pre.code.literal {
+    color: brown;
+}
+pre.code.comment {
+    color: magenta;
+}
+pre.code span.generic.prompt {
+    color: magenta;
+}
+pre.code span.generic.output {
+    color: gray;
+}
+
+.attention, .caution, .danger, .error, .warning, .important, .hint, .note, .tip {
+    padding: 0px;
+    margin: 5px 0px;
+    text-indent: 2em;
+}
+.hint, .note, .tip { border: green 1px solid; }
+.warning, .important { border: gold 1px solid; }
+.attention, .caution, .danger, .error { border: red 1px solid; }
+.attention p.first, .caution p.first, .danger p.first, .error p.first, .warning p.first, .important p.first, .hint p.first, .note p.first, .tip p.first {
+    margin: 0px;
+    padding: 5px 0px;
+}
+.hint p.first, .note p.first, .tip p.first { background: rgb(176, 255, 176); }
+.warning p.first, .important p.first { background: rgb(255, 233, 176); }
+.attention p.first, .caution p.first, .danger p.first, .error p.first { background: rgb(255, 196, 180); }
+.attention p, .caution p, .danger p, .error p, .warning p, .important p, .hint p, .note p, .tip p {
+    margin: 5px;
+}
+.attention pre, .caution pre, .danger pre, .error pre, .warning pre, .important pre, .hint pre, .note pre, .tip pre {
+    margin: 0 5px 5px 4em;
+}
+
+.def {
+    font-family: monospace;
+    color: hsl(120, 100%, 25%);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tmpl/rst.tmpl.in	Wed Mar 09 21:23:23 2016 +0200
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta name=viewport content="width=device-width, initial-scale=1">
+<meta charset="utf-8">
+%(head)s
+%(stylesheet)s
+%(body_prefix)s
+  <div id="sidebar"><iframe src="iframe.html"></iframe></div>
+  <div class="header container">
+      [ <a class="reference external" href="index.html">About</a>
+      | <a class="reference external" href="index.html#license">Licence</a>
+      | <a class="reference external" href="http://resume.defun.work/">Contacts</a> ]
+  </div>
+  <div class="header small container">
+      Written by Oleksandr Gavenko (AKA gavenkoa),
+      compiled on <tt class="docutils literal"><span class="pre">{date}</span></tt>
+      from rev <tt class="docutils literal">{rev}</tt>.
+  </div>
+%(body_pre_docinfo)s
+%(docinfo)s
+%(body)s
+%(body_suffix)s