プリンキピア

第22章付録:深層学習のための数学

22.10.3. Constructing Confidence Intervals22.10.3 信頼区間を構成する

When estimating the value of a parameter θ, point estimators like θˆ are of limited utility since they contain no notion of uncertainty. Rather, it would be far better if we could produce an interval that would contain the true parameter θ with high probability. If you were interested in such ideas a century ago, then you would have been excited to read “Outline of a Theory of Statistical Estimation Based on the Classical Theory of Probability” by Jerzy Neyman (Neyman, 1937), who first introduced the concept of confidence interval in 1937.
英語のヒント
パラメータθの値を推定するとき、θˆのような点推定量は不確かさという概念を含まないので、有用性が限られる。むしろ、真のパラメータθを高い確率で含む区間を作れれば、はるかによいだろう。1世紀前にこのような考えに興味があったなら、1937年に初めて信頼区間の概念を導入したイェジ・ネイマンの「Outline of a Theory of Statistical Estimation Based on the Classical Theory of Probability」(Neyman, 1937)を読んで心を躍らせただろう。
To be useful, a confidence interval should be as small as possible for a given degree of certainty. Let’s see how to derive it.
英語のヒント
役に立つためには、信頼区間は、与えられた確かさの度合いについてできるだけ小さくあるべきである。それをどう導くかを見よう。

22.10.3.1. Definition22.10.3.1 定義

Mathematically, a confidence interval for the true parameter θ is an interval Cn that computed from the sample data such that
英語のヒント
数学的には、真のパラメータθの信頼区間とは、標本データから計算される区間Cnであって、次を満たすものである。
Pθ(Cn∋θ)≥1−α,∀θ.(22.10.8)
Here α∈(0,1), and 1−α is called the confidence level or coverage of the interval. This is the same α as the significance level as we discussed about above.
英語のヒント
ここでα∈(0,1)であり、1−αは区間の信頼水準あるいは被覆率と呼ばれる。これは、上で論じた有意水準と同じαである。
Note that (22.10.8) is about variable Cn, not about the fixed θ. To emphasize this, we write Pθ(Cn∋θ) rather than Pθ(θ∈Cn).
英語のヒント
式(22.10.8)は、固定されたθについてではなく、変数Cnについてのものであることに注意しよう。これを強調するため、Pθ(θ∈Cn)ではなくPθ(Cn∋θ)と書く。

22.10.3.2. Interpretation22.10.3.2 解釈

It is very tempting to interpret a 95% confidence interval as an interval where you can be 95% sure the true parameter lies, however this is sadly not true. The true parameter is fixed, and it is the interval that is random. Thus a better interpretation would be to say that if you generated a large number of confidence intervals by this procedure, 95% of the generated intervals would contain the true parameter.
英語のヒント
95%信頼区間を、真のパラメータがある区間だと95%確信できる区間と解釈したくなるのはとても自然だが、残念ながらこれは正しくない。真のパラメータは固定されており、ランダムなのは区間のほうである。したがって、よりよい解釈は、この手順で多数の信頼区間を生成したら、生成された区間の95%が真のパラメータを含む、と言うことだろう。
This may seem pedantic, but it can have real implications for the interpretation of the results. In particular, we may satisfy (22.10.8) by constructing intervals that we are almost certain do not contain the true value, as long as we only do so rarely enough. We close this section by providing three tempting but false statements. An in-depth discussion of these points can be found in Morey et al. (2016).
英語のヒント
これは杓子定規に見えるかもしれないが、結果の解釈に実際の影響を及ぼしうる。とくに、真の値を含まないことがほぼ確実な区間を作っても、そうすることが十分まれでありさえすれば、式(22.10.8)を満たせてしまう。この節を締めくくるにあたり、もっともらしいが誤った三つの言明を挙げる。これらの点についての詳しい議論は、Morey et al.(2016)にある。
  • Fallacy 1. Narrow confidence intervals mean we can estimate the parameter precisely.
    英語のヒント
    誤謬1。狭い信頼区間は、パラメータを精密に推定できることを意味する。
  • Fallacy 2. The values inside the confidence interval are more likely to be the true value than those outside the interval.
    英語のヒント
    誤謬2。信頼区間の内側の値は、区間の外側の値よりも真の値である可能性が高い。
  • Fallacy 3. The probability that a particular observed 95% confidence interval contains the true value is 95%.
    英語のヒント
    誤謬3。観測された特定の95%信頼区間が真の値を含む確率は95%である。
Sufficed to say, confidence intervals are subtle objects. However, if you keep the interpretation clear, they can be powerful tools.
英語のヒント
言うまでもなく、信頼区間は微妙な対象である。しかし、解釈をはっきり保てば、強力な道具になりうる。

22.10.3.3. A Gaussian Example22.10.3.3 ガウス分布の例

Let’s discuss the most classical example, the confidence interval for the mean of a Gaussian of unknown mean and variance. Suppose we collect n samples {xi}i=1n from our Gaussian 𝒩(μ,σ2). We can compute estimators for the mean and variance by taking
英語のヒント
最も古典的な例、つまり平均と分散が未知のガウス分布の平均の信頼区間を論じよう。ガウス分布𝒩(μ,σ2)からn個の標本{xi}i=1nを集めるとする。平均と分散の推定量は、次のようにとって計算できる。
μˆn=1n∑i=1nxiandσˆn2=1n−1∑i=1n(xi−μˆ)2.(22.10.9)
If we now consider the random variable
英語のヒント
ここで次の確率変数を考えると、
T=μˆn−μσˆn/n,(22.10.10)
we obtain a random variable following a well-known distribution called the Student’s t-distribution on n−1 degrees of freedom.
英語のヒント
自由度n−1のスチューデントのt分布と呼ばれる、よく知られた分布に従う確率変数が得られる。
This distribution is very well studied, and it is known, for instance, that as n→∞, it is approximately a standard Gaussian, and thus by looking up values of the Gaussian c.d.f. in a table, we may conclude that the value of T is in the interval [−1.96,1.96] at least 95% of the time. For finite values of n, the interval needs to be somewhat larger, but are well known and precomputed in tables.
英語のヒント
この分布はとてもよく研究されており、たとえばn→∞とすると近似的に標準ガウス分布になることが知られている。したがって、表でガウス分布のc.d.f.の値を引けば、Tの値が少なくとも時間の95%は区間[−1.96,1.96]にあると結論できる。有限のnの値については、区間はいくらか大きくする必要があるが、それらはよく知られていて表であらかじめ計算されている。
Thus, we may conclude that for large n,
英語のヒント
したがって、大きなnについて次のように結論できる。
P(μˆn−μσˆn/n∈[−1.96,1.96])≥0.95.(22.10.11)
Rearranging this by multiplying both sides by σˆn/n and then adding μˆn, we obtain
英語のヒント
両辺にσˆn/nを掛けてからμˆnを足して並べ替えると、次が得られる。
P(μ∈[μˆn−1.96σˆnn,μˆn+1.96σˆnn])≥0.95.(22.10.12)
Thus we know that we have found our 95% confidence interval:
英語のヒント
したがって、95%信頼区間が見つかったことがわかる。
[μˆn−1.96σˆnn,μˆn+1.96σˆnn].(22.10.13)
It is safe to say that (22.10.13) is one of the most used formula in statistics. Let’s close our discussion of statistics by implementing it. For simplicity, we assume we are in the asymptotic regime. Small values of N should include the correct value of t_star obtained either programmatically or from a t-table.
英語のヒント
式(22.10.13)は統計学で最もよく使われる式の一つだと言って差し支えない。これを実装して、統計学の議論を締めくくろう。簡単にするため、漸近的な領域にいると仮定する。Nが小さい値のときは、プログラムで得るかt表から得たt_starの正しい値を含めるべきである。
# PyTorch uses Bessel's correction by default, which means the use of ddof=1
# instead of default ddof=0 in numpy. We can use unbiased=False to imitate
# ddof=0.

# Number of samples
N = 1000

# Sample dataset
samples = torch.normal(0, 1, size=(N,))

# Lookup Students's t-distribution c.d.f.
t_star = 1.96

# Construct interval
mu_hat = torch.mean(samples)
sigma_hat = samples.std(unbiased=True)
(mu_hat - t_star*sigma_hat/torch.sqrt(torch.tensor(N, dtype=torch.float32)),\
 mu_hat + t_star*sigma_hat/torch.sqrt(torch.tensor(N, dtype=torch.float32)))
(tensor(-0.0568), tensor(0.0704))