Σ
SDCalc
中級応用·12 min

時系列データの移動標準偏差

時系列分析における移動(ローリング)標準偏差の計算と解釈方法を解説。ボリンジャーバンド、ボラティリティ・クラスタリング、Pythonコード例、金融分野での実践的な応用を紹介。

移動標準偏差とは?

移動標準偏差(ローリングSD、トレーリング・ボラティリティとも呼ばれます)は、スライディングウィンドウの期間にわたって標準偏差を計算するものです。すべての過去データを使用する静的な標準偏差とは異なり、移動SDは直近の観測値に焦点を当て、時間の経過に伴うボラティリティの変化を検出するのに不可欠です。

この手法は金融市場において基本的なものです。ボラティリティは一定ではなく、時間とともに変化します。ある株式は数ヶ月間穏やかに推移した後、決算発表や市場危機の際に突然高いボラティリティになることがあります。移動SDはこうした動態をリアルタイムで捉えます。

なぜ移動SDが重要か

静的な標準偏差はすべての過去データを等しく扱いますが、直近のボラティリティは遠い過去よりも将来のボラティリティをよく予測することが多いです。移動SDは変化する市場環境に適応した、即座に活用できるリスク指標を提供します。

ローリング標準偏差の計算方法

各時点で、直前のn個のデータ点の標準偏差を計算します。時間が進むにつれてウィンドウがスライドし、常に最新のn個の値を使用します。これによりボラティリティ推定値の時系列が作成されます。

1

ウィンドウを定義する

各計算に含める期間数(例:20日)を選びます。
2

最初のSDを計算する

最初のn個のデータ点の標準偏差を計算します。
3

ウィンドウをスライドさせる

1期間前に進み、最も古い値を削除し、最新の値を追加します。
4

繰り返す

データ系列の最後に到達するまで続けます。
python
import pandas as pd
import numpy as np

# Load your time series data
df = pd.read_csv('stock_prices.csv')

# 20-day rolling standard deviation
df['rolling_std_20'] = df['returns'].rolling(window=20).std()

# Annualized volatility (assuming daily returns)
df['annualized_vol'] = df['rolling_std_20'] * np.sqrt(252)

# Multiple windows for comparison
df['rolling_std_10'] = df['returns'].rolling(window=10).std()
df['rolling_std_50'] = df['returns'].rolling(window=50).std()

最初の(ウィンドウ-1)個の値は、計算に少なくともn個の観測値が必要なためNaNになります。実際には、min_periodsパラメータを使用して、より少ない観測値で早期に計算を開始することもできます。

適切なウィンドウサイズの選択

ウィンドウサイズは応答性と安定性のトレードオフを生みます。

  • 短いウィンドウ(5〜10日):ボラティリティの変化に素早く反応するが、ノイズが多く偽シグナルを出しやすい
  • 中程度のウィンドウ(20〜30日):応答性と安定性のバランスが良い。20日はボリンジャーバンドの業界標準
  • 長いウィンドウ(50〜100日):滑らかで安定しているが、レジーム変化の検出が遅い。トレンド分析に適している

便利なヒント

複数のウィンドウサイズを併用しましょう。10日、20日、50日の移動SDを比較すると、短期的な変動と長期的なボラティリティのトレンドの両方を把握できます。これらの乖離はレジーム変化のシグナルになることがあります。

実世界での応用

移動標準偏差は金融やデータサイエンスで幅広く使用されています。

  • リスク管理:過去の平均ではなく直近のボラティリティを用いてバリュー・アット・リスク(VaR)を計算
  • オプション価格決定:ブラック-ショールズなどのモデルのインプライド・ボラティリティ・パラメータを推定
  • ポートフォリオ管理:現在のボラティリティに基づいてポジションサイズを調整。ボラティリティ上昇時にはエクスポージャーを削減
  • 異常検出:現在のボラティリティが移動平均から大きく乖離する異常期間を特定
  • テクニカル分析:ボリンジャーバンド、ケルトナーチャネルなどのボラティリティベースの指標

ボリンジャーバンドの解説

ボリンジャーバンドは、移動標準偏差の最も有名な応用です。1980年代にジョン・ボリンジャーが開発したもので、ボラティリティに適応する動的なエンベロープを価格の周りに作成します。

ボリンジャーバンド

Upper Band = SMA(20) + 2 × Moving SD(20) Lower Band = SMA(20) - 2 × Moving SD(20)

バンドはボラティリティの高い期間に広がり、穏やかな期間に縮小します。トレーダーはこれを以下のように活用します。

  • 価格がバンドに触れた際の買われすぎ/売られすぎの状態を特定
  • ブレイクアウトの前兆となることが多い「スクイーズ」(低ボラティリティ)を検出
  • 現在の市場状況に基づいた動的なストップロスの設定

ボラティリティ・クラスタリング

金融における最も重要な経験的事実のひとつは、ボラティリティが群れを成すということです—高いボラティリティの後には高いボラティリティが続き、低いボラティリティの後には低いボラティリティが続きます。これはロバート・エングル(2003年ノーベル賞)がARCHモデルとして定式化しました。

移動SDはこのクラスタリングを視覚的に明らかにします。時間経過とともにローリングボラティリティをプロットすると、ランダムな変動ではなく、高ボラティリティと低ボラティリティの明確なレジームが見えます。これには深い意味があります。

  • 予測可能性:明日のボラティリティは今日と似ている可能性が高い—リスクを予測できる
  • リスク・バジェティング:高ボラティリティのレジームに入った際にポジションを縮小する
  • 戦略の選択:ボラティリティの環境によって異なるトレーディング戦略が有効

重要な注意点

ボラティリティはクラスタリングする一方で、レジーム変化は突然かつ劇的に起こりえます。重大なニュース、市場の暴落、政策発表はボラティリティのレジームを瞬時に変えます。移動SDは常にこうした変化に遅れをとり、新しい現実を反映する頃にはレジームが再び変わっている可能性があります。

Further Reading

How to Read This Article

A statistics tutorial is a practical interpretation guide, not just a formula dump. It refers to the assumptions, notation, and reporting language that analysts need when they explain a result to a teacher, manager, client, or reviewer. The article body covers the specific topic, while the sections below create a common interpretation frame that readers can reuse across related metrics.

Reading goalWhat to focus onCommon mistake
DefinitionWhat the metric is and what quantity it summarizesTreating the formula as self-explanatory
Formula choiceSample versus population assumptions and notationUsing n when n-1 is required or vice versa
InterpretationWhether the result indicates concentration, spread, or riskCalling a large value good or bad without context

Frequently Asked Questions

How should I interpret a high standard deviation?

A high standard deviation means the observations are spread farther from the mean on average. Whether that spread is acceptable depends on the context: wide dispersion might signal risk in finance, instability in manufacturing, or genuine natural variation in scientific data.

Why do some articles mention n while others mention n-1?

The denominator reflects the difference between population and sample formulas. Population variance and population standard deviation use N because the full dataset is known. Sample variance and sample standard deviation often use n-1 because Bessel’s correction reduces bias when estimating population spread from a sample.

What is a statistical interpretation guide?

A statistical interpretation guide is a page that moves beyond arithmetic and explains meaning. It tells you what a metric is, when the formula applies, and how to describe the result in plain English without overstating certainty.

Can I cite this article in a report?

You should cite the underlying authoritative reference for formal work whenever possible. This page is best used as an explanatory bridge that helps you understand the concept before quoting the original standard or handbook.

Why include direct citations on every article page?

Direct citations give readers a route to verify the definition, notation, and assumptions. That improves trust and reduces the chance that a simplified explanation is mistaken for the entire technical standard.

Authoritative References

These sources define the concepts referenced most often across our articles. Bessel's correction is a sample adjustment, variance is a squared measure of spread, and standard deviation is the square root of variance expressed in the same units as the data.