プリンキピア

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

22.10.2. Conducting Hypothesis Tests22.10.2 仮説検定を行う

The most commonly encountered topic in statistical inference is hypothesis testing. While hypothesis testing was popularized in the early 20th century, the first use can be traced back to John Arbuthnot in the 1700s. John tracked 80-year birth records in London and concluded that more men were born than women each year. Following that, the modern significance testing is the intelligence heritage by Karl Pearson who invented p-value and Pearson’s chi-squared test, William Gosset who is the father of Student’s t-distribution, and Ronald Fisher who initialed the null hypothesis and the significance test.
英語のヒント
統計的推論で最もよく出会う話題は仮説検定である。仮説検定が広まったのは20世紀初めだが、最初の使用は1700年代のジョン・アーバスノットにまでさかのぼれる。アーバスノットはロンドンの80年分の出生記録を追い、毎年、女性より男性のほうが多く生まれていると結論した。その後、現代の有意性検定は、p値とピアソンのカイ二乗検定を考案したカール・ピアソン、スチューデントのt分布の父であるウィリアム・ゴセット、帰無仮説と有意性検定を始めたロナルド・フィッシャーによる知の遺産である。
A hypothesis test is a way of evaluating some evidence against the default statement about a population. We refer the default statement as the null hypothesis H0, which we try to reject using the observed data. Here, we use H0 as a starting point for the statistical significance testing. The alternative hypothesis HA (or H1) is a statement that is contrary to the null hypothesis. A null hypothesis is often stated in a declarative form which posits a relationship between variables. It should reflect the brief as explicit as possible, and be testable by statistics theory.
英語のヒント
仮説検定とは、母集団についての既定の言明に反する何らかの証拠を評価する方法である。既定の言明を帰無仮説H0と呼び、観測データを使ってこれを棄却しようとする。ここでは、統計的有意性の検定の出発点としてH0を使う。対立仮説HA(あるいはH1)は、帰無仮説に反する言明である。帰無仮説は、変数間の関係を置く宣言的な形で述べられることが多い。それは前提をできるだけ明示的に反映し、統計理論で検定できるものであるべきである。
Imagine you are a chemist. After spending thousands of hours in the lab, you develop a new medicine which can dramatically improve one’s ability to understand math. To show its magic power, you need to test it. Naturally, you may need some volunteers to take the medicine and see whether it can help them learn mathematics better. How do you get started?
英語のヒント
化学者だと想像してみよう。研究室で何千時間も費やした後、数学を理解する能力を劇的に向上させる新しい薬を開発した。その魔法の力を示すには、検証する必要がある。当然、何人かのボランティアに薬を飲んでもらい、数学をよりよく学ぶのに役立つかどうかを見る必要があるだろう。どのように始めればよいだろうか。
First, you will need carefully random selected two groups of volunteers, so that there is no difference between their mathematical understanding ability measured by some metrics. The two groups are commonly referred to as the test group and the control group. The test group (or treatment group) is a group of individuals who will experience the medicine, while the control group represents the group of users who are set aside as a benchmark, i.e., identical environment setups except taking this medicine. In this way, the influence of all the variables are minimized, except the impact of the independent variable in the treatment.
英語のヒント
まず、何らかの指標で測った数学の理解力に差がないように、ボランティアの二つのグループを注意深くランダムに選ぶ必要がある。二つのグループは、ふつう試験群と対照群と呼ばれる。試験群(あるいは処置群)は薬を経験する個人のグループであり、対照群は基準として取り置かれる利用者のグループ、つまりこの薬を飲むこと以外は同一の環境設定のグループを表す。こうすることで、処置における独立変数の影響を除いて、すべての変数の影響が最小になる。
Second, after a period of taking the medicine, you will need to measure the two groups’ mathematical understanding by the same metrics, such as letting the volunteers do the same tests after learning a new mathematical formula. Then, you can collect their performance and compare the results. In this case, our null hypothesis will be that there is no difference between the two groups, and our alternate will be that there is.
英語のヒント
次に、薬を飲む期間の後、新しい数式を学んだ後にボランティアに同じテストを受けてもらうなどして、同じ指標で二つのグループの数学の理解を測る必要がある。それから、成績を集めて結果を比べられる。この場合、帰無仮説は二つのグループの間に差がないことであり、対立仮説は差があることである。
This is still not fully formal. There are many details you have to think of carefully. For example, what is the suitable metrics to test their mathematical understanding ability? How many volunteers for your test so you can be confident to claim the effectiveness of your medicine? How long should you run the test? How do you decide if there is a difference between the two groups? Do you care about the average performance only, or also the range of variation of the scores? And so on.
英語のヒント
これでもまだ完全に形式的ではない。注意深く考えなければならない細部がたくさんある。たとえば、数学の理解力を検定するのに適した指標は何か。薬の有効性を自信をもって主張するには、テストに何人のボランティアが必要か。テストはどれくらいの期間行うべきか。二つのグループの間に差があるかどうかをどう決めるか。平均的な成績だけを気にするのか、それとも点数の変動の範囲も気にするのか。などなど。
In this way, hypothesis testing provides a framework for experimental design and reasoning about certainty in observed results. If we can now show that the null hypothesis is very unlikely to be true, we may reject it with confidence.
英語のヒント
このようにして、仮説検定は、実験計画と、観測結果の確かさについての推論のための枠組みを与える。帰無仮説が真である可能性がとても低いことを示せれば、自信をもってそれを棄却できる。
To complete the story of how to work with hypothesis testing, we need to now introduce some additional terminology and make some of our concepts above formal.
英語のヒント
仮説検定の扱い方の話を完結させるには、いくつかの追加の用語を導入し、上の概念のいくつかを形式的にする必要がある。

22.10.2.1. Statistical Significance22.10.2.1 統計的有意性

The statistical significance measures the probability of erroneously rejecting the null hypothesis, H0, when it should not be rejected, i.e.,
英語のヒント
統計的有意性は、帰無仮説H0を棄却すべきでないときに誤って棄却する確率を測る。つまり、
statistical significance =1−α=1−P(reject H0∣H0 is true).(22.10.5)
It is also referred to as the type I error or false positive. The α, is called as the significance level and its commonly used value is 5%, i.e., 1−α=95%. The significance level can be explained as the level of risk that we are willing to take, when we reject a true null hypothesis.
英語のヒント
これは第1種の過誤、あるいは偽陽性とも呼ばれる。αは有意水準と呼ばれ、よく使われる値は5%、つまり1−α=95%である。有意水準は、真の帰無仮説を棄却するときに引き受けてもよいリスクの水準として説明できる。
Fig. 22.10.1 shows the observations’ values and probability of a given normal distribution in a two-sample hypothesis test. If the observation data example is located outsides the 95% threshold, it will be a very unlikely observation under the null hypothesis assumption. Hence, there might be something wrong with the null hypothesis and we will reject it.
英語のヒント
図22.10.1は、2標本の仮説検定において、与えられた正規分布の観測値とその確率を示している。観測データの例が95%のしきい値の外にあるなら、それは帰無仮説の仮定のもとではとても起こりにくい観測である。したがって、帰無仮説に何か問題があるかもしれず、それを棄却する。
Fig. 22.10.1図22.10.1
Statistical significance.
英語のヒント
統計的有意性。

22.10.2.2. Statistical Power22.10.2.2 検出力

The statistical power (or sensitivity) measures the probability of reject the null hypothesis, H0, when it should be rejected, i.e.,
英語のヒント
検出力(あるいは感度)は、帰無仮説H0を棄却すべきときに棄却する確率を測る。つまり、
statistical power =1−β=1−P( fail to reject H0∣H0 is false).(22.10.6)
Recall that a type I error is error caused by rejecting the null hypothesis when it is true, whereas a type II error is resulted from failing to reject the null hypothesis when it is false. A type II error is usually denoted as β, and hence the corresponding statistical power is 1−β.
英語のヒント
第1種の過誤は帰無仮説が真であるときにそれを棄却することによる誤りであり、第2種の過誤は帰無仮説が偽であるときにそれを棄却できないことから生じることを思い出そう。第2種の過誤はふつうβで表され、したがって対応する検出力は1−βである。
Intuitively, statistical power can be interpreted as how likely our test will detect a real discrepancy of some minimum magnitude at a desired statistical significance level. 80% is a commonly used statistical power threshold. The higher the statistical power, the more likely we are to detect true differences.
英語のヒント
直観的には、検出力は、望む有意水準で、ある最小の大きさの本当の食い違いを検定がどれくらい検出しそうかとして解釈できる。80%がよく使われる検出力のしきい値である。検出力が高いほど、本当の差を検出しやすくなる。
One of the most common uses of statistical power is in determining the number of samples needed. The probability you reject the null hypothesis when it is false depends on the degree to which it is false (known as the effect size) and the number of samples you have. As you might expect, small effect sizes will require a very large number of samples to be detectable with high probability. While beyond the scope of this brief appendix to derive in detail, as an example, want to be able to reject a null hypothesis that our sample came from a mean zero variance one Gaussian, and we believe that our sample’s mean is actually close to one, we can do so with acceptable error rates with a sample size of only 8. However, if we think our sample population true mean is close to 0.01, then we’d need a sample size of nearly 80000 to detect the difference.
英語のヒント
検出力の最もよくある使い道の一つは、必要な標本の数を決めることである。帰無仮説が偽であるときにそれを棄却する確率は、それがどの程度偽であるか(効果量として知られる)と、手元の標本の数に依存する。予想されるように、効果量が小さいと、高い確率で検出できるようにするにはとても多くの標本が必要になる。この短い付録で詳しく導くのは範囲を超えるが、例として、標本が平均0、分散1のガウス分布から来たという帰無仮説を棄却できるようにしたく、標本の平均は実際には1に近いと信じているなら、標本の大きさがわずか8でも、許容できる誤り率でそうできる。しかし、標本の母集団の真の平均が0.01に近いと考えるなら、差を検出するには80000近くの標本の大きさが必要になる。
We can imagine the power as a water filter. In this analogy, a high power hypothesis test is like a high quality water filtration system that will reduce harmful substances in the water as much as possible. On the other hand, a smaller discrepancy is like a low quality water filter, where some relative small substances may easily escape from the gaps. Similarly, if the statistical power is not of enough high power, then the test may not catch the smaller discrepancy.
英語のヒント
検出力は浄水器として想像できる。このたとえでは、検出力の高い仮説検定は、水の中の有害な物質をできるだけ減らす高品質な浄水システムのようなものである。他方、小さな食い違いは低品質な浄水器のようなもので、比較的小さな物質がすき間から簡単にすり抜けてしまうことがある。同様に、検出力が十分に高くなければ、検定は小さな食い違いをとらえられないかもしれない。

22.10.2.3. Test Statistic22.10.2.3 検定統計量

A test statistic T(x) is a scalar which summarizes some characteristic of the sample data. The goal of defining such a statistic is that it should allow us to distinguish between different distributions and conduct our hypothesis test. Thinking back to our chemist example, if we wish to show that one population performs better than the other, it could be reasonable to take the mean as the test statistic. Different choices of test statistic can lead to statistical test with drastically different statistical power.
英語のヒント
検定統計量T(x)は、標本データのある特性を要約するスカラーである。このような統計量を定義する目的は、それによって異なる分布を見分け、仮説検定を行えるようにすることである。化学者の例を思い返すと、一方の母集団がもう一方より成績がよいことを示したいなら、平均を検定統計量にとるのはもっともかもしれない。検定統計量の選び方が違うと、検出力が大きく異なる統計的検定になりうる。
Often, T(X) (the distribution of the test statistic under our null hypothesis) will follow, at least approximately, a common probability distribution such as a normal distribution when considered under the null hypothesis. If we can derive explicitly such a distribution, and then measure our test statistic on our dataset, we can safely reject the null hypothesis if our statistic is far outside the range that we would expect. Making this quantitative leads us to the notion of p-values.
英語のヒント
多くの場合、T(X)(帰無仮説のもとでの検定統計量の分布)は、帰無仮説のもとで考えると、少なくとも近似的には、正規分布のようなよくある確率分布に従う。このような分布を明示的に導き、データセットで検定統計量を測れるなら、統計量が予想される範囲から大きく外れていれば、安全に帰無仮説を棄却できる。これを定量的にすると、p値という概念に行き着く。

22.10.2.4. p-value22.10.2.4 p値

The p-value (or the probability value) is the probability that T(X) is at least as extreme as the observed test statistic T(x) assuming that the null hypothesis is true, i.e.,
英語のヒント
p値(あるいは確率値)とは、帰無仮説が真であると仮定したとき、T(X)が観測された検定統計量T(x)と少なくとも同じくらい極端になる確率である。つまり、
p-value=PH0(T(X)≥T(x)).(22.10.7)
If the p-value is smaller than or equal to a predefined and fixed statistical significance level α, we may reject the null hypothesis. Otherwise, we will conclude that we are lack of evidence to reject the null hypothesis. For a given population distribution, the region of rejection will be the interval contained of all the points which has a p-value smaller than the statistical significance level α.
英語のヒント
p値が、あらかじめ決めて固定した有意水準α以下なら、帰無仮説を棄却できる。そうでなければ、帰無仮説を棄却する証拠が足りないと結論する。与えられた母集団の分布について、棄却域は、p値が有意水準αより小さいすべての点を含む区間になる。

22.10.2.5. One-side Test and Two-sided Test22.10.2.5 片側検定と両側検定

Normally there are two kinds of significance test: the one-sided test and the two-sided test. The one-sided test (or one-tailed test) is applicable when the null hypothesis and the alternative hypothesis only have one direction. For example, the null hypothesis may state that the true parameter θ is less than or equal to a value c. The alternative hypothesis would be that θ is greater than c. That is, the region of rejection is on only one side of the sampling distribution. Contrary to the one-sided test, the two-sided test (or two-tailed test) is applicable when the region of rejection is on both sides of the sampling distribution. An example in this case may have a null hypothesis state that the true parameter θ is equal to a value c. The alternative hypothesis would be that θ is not equal to c.
英語のヒント
ふつう、有意性検定には二種類ある。片側検定と両側検定である。片側検定(あるいは片側裾の検定)は、帰無仮説と対立仮説が一つの向きしかもたないときに適用できる。たとえば、帰無仮説は、真のパラメータθがある値c以下であると述べるかもしれない。対立仮説は、θがcより大きいということになる。つまり、棄却域は標本分布の片側だけにある。片側検定とは対照的に、両側検定(あるいは両側裾の検定)は、棄却域が標本分布の両側にあるときに適用できる。この場合の例としては、帰無仮説が、真のパラメータθがある値cに等しいと述べるかもしれない。対立仮説は、θがcに等しくないということになる。

22.10.2.6. General Steps of Hypothesis Testing22.10.2.6 仮説検定の一般的な手順

After getting familiar with the above concepts, let’s go through the general steps of hypothesis testing.
英語のヒント
上の概念に慣れたところで、仮説検定の一般的な手順をたどろう。
  1. State the question and establish a null hypotheses H0.
    英語のヒント
    問いを述べ、帰無仮説H0を立てる。
  2. Set the statistical significance level α and a statistical power (1−β).
    英語のヒント
    有意水準αと検出力(1−β)を設定する。
  3. Obtain samples through experiments. The number of samples needed will depend on the statistical power, and the expected effect size.
    英語のヒント
    実験を通じて標本を得る。必要な標本の数は、検出力と予想される効果量に依存する。
  4. Calculate the test statistic and the p-value.
    英語のヒント
    検定統計量とp値を計算する。
  5. Make the decision to keep or reject the null hypothesis based on the p-value and the statistical significance level α.
    英語のヒント
    p値と有意水準αにもとづいて、帰無仮説を保つか棄却するかを決める。
To conduct a hypothesis test, we start by defining a null hypothesis and a level of risk that we are willing to take. Then we calculate the test statistic of the sample, taking an extreme value of the test statistic as evidence against the null hypothesis. If the test statistic falls within the reject region, we may reject the null hypothesis in favor of the alternative.
英語のヒント
仮説検定を行うには、まず帰無仮説と、引き受けてもよいリスクの水準を定める。それから標本の検定統計量を計算し、検定統計量の極端な値を帰無仮説に反する証拠とみなす。検定統計量が棄却域に入れば、帰無仮説を棄却して対立仮説を採ってよい。
Hypothesis testing is applicable in a variety of scenarios such as the clinical trails and A/B testing.
英語のヒント
仮説検定は、臨床試験やA/Bテストのようなさまざまな場面で適用できる。