1. 統計とは何をするもの?
統計は、多数のデータを整理して特徴をつかみ、そこから判断や予測を行うための方法です。
統計の考え方は、大きく記述統計と推測統計に分けられます。
| 分類 | 目的 | 代表的な用語 |
| 記述統計 |
手元にあるデータの特徴を要約する |
平均、中央値、最頻値、分散、標準偏差 |
| 推測統計 |
標本から母集団の性質を推定・検定する |
信頼区間、p値、仮説検定、回帰分析 |
まず「データの中心」を表す平均・中央値・最頻値を確認し、次に「ばらつき」を表す分散・標準偏差、
さらにp値や回帰分析へ進むと、用語同士のつながりを理解しやすくなります。
2. 平均(mean)・中央値(median)・最頻値(mode)
平均、中央値、最頻値は、いずれもデータの中心や代表的な値を表します。
ただし、計算方法と向いている場面が異なります。
| 指標 | 意味 | 向いている場面 |
| 平均(mean) |
すべての値の合計をデータ数で割った値 |
極端な外れ値が少ない数値データ |
| 中央値(median) |
値を小さい順に並べたときの中央の値 |
年収や価格など、偏りや外れ値があるデータ |
| 最頻値(mode) |
データの中で最も多く現れる値 |
最も一般的なサイズ、回答、カテゴリを知りたいとき |
具体例:待ち時間
5人の待ち時間が 2, 3, 3, 4, 18 分だったとします。
平均 = (2 + 3 + 3 + 4 + 18) ÷ 5 = 6分
中央値は小さい順に並べた3番目の3分、最頻値も最も多く現れる3分です。
18分という大きな値によって、平均だけが6分まで引き上げられています。
このように平均はすべての値を反映する一方、外れ値の影響を受けやすい指標です。
分布が偏っている場合は、平均と中央値を併記すると実態を伝えやすくなります。
3. 分散・標準偏差・σ(シグマ)
代表値だけでは、データがどの程度散らばっているかは分かりません。
例えば 4, 5, 6 と 0, 5, 10 は、どちらも平均5ですが、
後者の方が大きくばらついています。
| 用語 | 意味 |
| 偏差 | 各データと平均の差 |
| 分散 | 偏差を二乗し、その平均を求めた値 |
| 標準偏差 | 分散の平方根。元のデータと同じ単位で表せる |
| σ(シグマ) | 母集団の標準偏差を表すときによく使う記号 |
具体例:2、4、6のばらつき
平均は4、平均との差である偏差は -2, 0, 2、
偏差の二乗は 4, 0, 4 です。
母分散 σ² = (4 + 0 + 4) ÷ 3 = 8/3 ≈ 2.67
母標準偏差 σ = √(8/3) ≈ 1.63
偏差をそのまま足すと0になるため、二乗して正負を打ち消します。
分散は単位も二乗されますが、標準偏差は平方根を取るので元データと同じ単位で解釈できます。
nで割る場合とn−1で割る場合
手元のデータ全体を説明するときは、一般にデータ数 n で割ります。
一方、標本から母集団の分散を推定するときは、n−1 で割る不偏分散がよく使われます。
表計算ソフトや統計ソフトを使うときも、母集団用と標本用のどちらの関数かを確認しましょう。
4. p値(p-value)と仮説検定
p値は、帰無仮説が正しいと仮定したとき、観測結果以上に極端な結果が得られる確率です。
帰無仮説とは、例えば「新しい方法と従来の方法に平均差はない」のような、検定の出発点となる仮説です。
p値は「帰無仮説が正しい確率」でも、「今回の結果が偶然である確率」でもありません。
ここはp値を理解するうえで最も重要な点です。
仮説検定の基本的な流れ
- 帰無仮説
H₀ を決める
- データを見る前に有意水準
α を決める
- 研究設計とデータに合った検定を選ぶ
- 検定統計量とp値を計算する
p < α なら帰無仮説を棄却する
有意水準には0.05がよく使われますが、絶対的な境界ではありません。
p=0.049 と p=0.051 に本質的な大差があるわけではなく、
目的や誤判定の影響を考えて基準を決める必要があります。
p値だけでは差の大きさは分からない
サンプル数が非常に多ければ、小さな差でもp値が小さくなることがあります。
反対にサンプル数が少なければ、実務的に重要な差があっても検出できない場合があります。
- 効果量:差や関連がどの程度大きいか
- 信頼区間:推定値にどの程度の不確かさがあるか
- サンプル数:検出力や推定の安定性が十分か
- グラフ:外れ値や分布の偏りがないか
結論を出すときは、p値だけでなく、これらの情報も合わせて確認します。
5. 回帰分析とは
回帰分析は、ある変数と別の変数の関係を式で表し、関係の説明や予測に利用する方法です。
説明変数が一つの単回帰分析では、一般に次の直線を考えます。
予測値 ŷ = a + bx
x:説明変数
ŷ:回帰式による予測値
a:切片。x=0のときの予測値
b:傾き。xが1増えたときのyの平均的な変化量
例えば、勉強時間をx、テスト得点をyとして回帰分析を行うと、
勉強時間が1時間増えたときに得点が平均的にどの程度変化するかを傾きで表せます。
ただし、回帰分析で関連が見つかっても、それだけで因果関係が証明されたとはいえません。
第三の要因やデータの集め方も検討する必要があります。
6. 最小二乗法とは
観測値 yᵢ と回帰式による予測値 ŷᵢ の差を残差と呼びます。
最小二乗法は、次の残差平方和が最も小さくなる傾きと切片を選ぶ方法です。
残差平方和 = Σ(yᵢ − ŷᵢ)²
残差を二乗することで正負の誤差が打ち消し合うのを防ぎ、大きな誤差をより強く評価します。
その一方で、大きな外れ値の影響を受けやすい点には注意が必要です。
回帰結果で確認する項目
| 項目 | 確認する内容 |
| 傾き |
xが1単位増えたとき、yが平均的にどれだけ変化するか |
| 切片 |
x=0での予測値。x=0が現実的でない場合は解釈に注意する |
| R²(決定係数) |
モデルがyのばらつきをどの程度説明しているか |
| p値 |
「母集団で傾きが0」という仮説に対する検定結果 |
| 残差 |
非線形性、ばらつきの不均一、外れ値などがないか |
回帰直線を信用する前に、まず散布図で関係が直線的かを確認し、残差にも規則的なパターンがないかを調べます。
また、観測した範囲を大きく超える予測である外挿は、誤差が大きくなりやすいため注意が必要です。
7. 統計を見るときの基本的な順序
- データ数、欠損値、入力ミスを確認する
- 平均・中央値・最頻値で中心を確認する
- 分散・標準偏差・箱ひげ図などでばらつきを確認する
- 散布図やヒストグラムで分布と外れ値を見る
- 目的に合った検定や回帰分析を選ぶ
- p値だけでなく、効果量・信頼区間・残差も確認する
統計量を計算する前にグラフでデータを見ることが重要です。
同じ平均や相関係数でも、分布の形や外れ値によって意味が大きく変わることがあります。
1. What Does Statistics Do?
Statistics provides methods for organizing data, describing its main features, and making estimates or decisions.
Descriptive statistics summarizes observed data, while inferential statistics
uses a sample to learn about a larger population.
| Area | Purpose | Examples |
| Descriptive statistics | Summarize observed data | Mean, median, mode, variance, standard deviation |
| Inferential statistics | Estimate or test population characteristics | Confidence intervals, p-values, hypothesis tests, regression |
2. Mean, Median, and Mode
| Measure | Meaning | Best used for |
| Mean | Sum divided by the number of observations | Numeric data without influential outliers |
| Median | Middle value after sorting | Skewed data such as income or prices |
| Mode | Most frequent value | The most common value or category |
For the waiting times 2, 3, 3, 4, 18:
Mean = (2 + 3 + 3 + 4 + 18) ÷ 5 = 6
The median is 3 and the mode is 3. The unusually long 18-minute wait pulls the mean upward,
while the median and mode remain unchanged.
3. Variance, Standard Deviation, and Sigma
Measures of center do not describe spread. The datasets 4, 5, 6 and 0, 5, 10
both have a mean of 5, but the second is much more dispersed.
| Term | Meaning |
| Deviation | Difference between an observation and the mean |
| Variance | Average squared deviation |
| Standard deviation | Square root of variance, expressed in the original unit |
| σ (sigma) | A symbol commonly used for population standard deviation |
For 2, 4, 6, the mean is 4 and the squared deviations are 4, 0, 4.
Population variance σ² = (4 + 0 + 4) ÷ 3 ≈ 2.67
Population standard deviation σ = √(8/3) ≈ 1.63
Dividing by n describes a complete population or the observed dataset itself.
Estimating population variance from a sample commonly uses n−1.
4. P-values and Hypothesis Tests
A p-value is the probability of obtaining a result at least as extreme as the observed result,
assuming the null hypothesis is true.
It is not the probability that the null hypothesis is true.
- State the null hypothesis.
- Choose a significance level before inspecting the result.
- Select a test that matches the design and data.
- Calculate the test statistic and p-value.
- Reject the null hypothesis when
p < α.
The common 0.05 threshold is a convention, not a law of nature.
Statistical significance is also different from practical importance.
Examine effect sizes, confidence intervals, sample size, assumptions, and plots together with the p-value.
5. Regression Analysis
Regression expresses the relationship between an explanatory variable x
and a response variable y. Simple linear regression uses:
Predicted value ŷ = a + bx
The intercept a is the prediction at x=0, and the slope b
is the average change in y for a one-unit increase in x.
A regression association does not by itself establish causation.
6. The Least-Squares Method
A residual is the difference eᵢ = yᵢ − ŷᵢ between an observed and predicted value.
Ordinary least squares chooses the intercept and slope that minimize:
Sum of squared residuals = Σ(yᵢ − ŷᵢ)²
Squaring prevents positive and negative errors from cancelling, but also makes the fit sensitive to outliers.
Inspect the slope, R², p-value, residuals, and uncertainty rather than judging a model from one number.
7. A Practical Order for Reading Data
- Check sample size, missing values, and input errors.
- Summarize the center with the mean, median, or mode.
- Measure spread with variance and standard deviation.
- Inspect distributions and outliers with appropriate plots.
- Choose a hypothesis test or regression model that matches the question.
- Report uncertainty, effect sizes, and diagnostics—not only p-values.
8. Key Takeaways
- The mean, median, and mode describe the center in different ways.
- Variance, standard deviation, and sigma describe spread.
- A p-value is defined under the assumption that the null hypothesis is true.
- Regression represents relationships between variables.
- Least squares minimizes the sum of squared residuals.
- Always inspect the data and the model assumptions.
References:
NIST/SEMATECH Statistical Glossary,
NIST/SEMATECH: Critical Values and p Values