LoginSignup
12
10

More than 5 years have passed since last update.

【#R言語】時系列データの周期特性とトレンドの成分分析 #統計学 #機械学習

Last updated at Posted at 2014-05-27

R言語を使って時系列データの周期特性とトレンドの成分分析を行う手順を自分用のメモとしてまとめました。

手順 1: サンプルデータ UKgas を読み込みます

R> data("UKgas")
R> UKgas

手順 2: 関数 str() を使って、時系列データ UKgas の構造を確認します

R> str(UKgas)
Time-Series [1:108] from 1960 to 1987: 160.1 129.7 84.8 120.1 160.1 ...

→ 1960年から1987年までのデータが格納された時系列データであることを確かめます。

手順 3: 関数 stl() と関数 plot() を使って、時系列データ UKgas の成分分解を行います

R> plot(stl(x=UKgas,s.window="periodic"))

→ data(元データ)が seasonal(周期特性)、trend(トレンド)、remainder(残差)の3つの成分に分解されたことを確かめます。

以上

12
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
10