% Miranda-Fackler (2002) p. 132のテンル積による計算結果がMatlabのkronの結果と同一であることの確認。
syms x1 x2;
aa = [ 1, x1, x1^2]
bb = [ 1, x2]
kron(bb, aa)
注:ベクトルの場合、テンソル積とクロネッカー積の結果は同一となる(だったはず)。テンソルは20年位やっておらず、知識が極めて怪しいので、正確に知りたい人はテンソル解析の教科書を見てください。
[参考文献]
condaを使う場合、
$ conda update conda
$ conda update anaconda
$ conda update --all
Anaconda Navigatorを起動して、バージョンが最新版になっていることを確認する。
TensorFlowとKerasのインストール
$ conda install -c jjhelmus tensorflow
$ conda install -c conda-forge keras
自分用の備忘録です。CRANにあるx13binaryが使えるようになったので、自分でX-13ARIMA-SEATSをコンパイルする必要がなくなりました。
[インストール]GNU Rで二つのパッケージをインストール
[GNU Rのパッケージseasonalからx13asを実行する]
[注意すべき点]
[s10やs11等のまとめ]
s10: 季節成分(seasonal component)
s11: 季節調整値(seasonal adjustment component)
s12: トレンド成分(trend component)
s13: 不規則成分(rregular component)
詳しくは以下のTable7.13を参照:
https://www.census.gov/ts/x13as/docX13AS.pdf
以下のサイトが非常に分かりやすかったです。
R で openxlsx パッケージを用いて xlsx ファイルを扱う - Qiita
http://qiita.com/zero310/items/71b6e5bc0731680d19df
Rで解析:セル体裁!大きなデータも大丈夫!エクセル操作の「openxlsx」パッケージ
http://www.karada-good.net/analyticsr/r-338
以下、自分用の覚書:
概況:
以下、「超過準備に対するマイナス金利」をマイナス金利政策と呼ぶ。
日本語によるまとめ:
英語によるまとめ:
日銀:
時系列解析で月次データを四半期に集約する(3ヶ月の合計や平均を計算する)ことはよくある。以下はstats, zoo, xtsを使った場合。
まず準備:
# 2010年1月から12月までの月次データを生成する
rm(list=ls())
dataLength <- 12
set.seed(1) # to make it reproducible
data1 <- rnorm(dataLength)
statsのtsオブジェクトに対してstatsのaggregateを使う場合:
dataMonthTs <- ts(data1, start=c(2010,1), frequency=12)
dataQuartTs <- aggregate(dataMonthTs, nfrequency = 4, FUN = sum)
dataQuartTs
以上のやり方はzooもxtsもなかった10年以上前にはよく使われていた。ただし、最近は以下のようにzooやxtsを使うほうが一般的かもしれない。
zooオブジェクトに対してzooのaggregateを使う場合:
library(zoo)
dateZoo <- seq(as.Date("2010-01-01"), as.Date("2010-12-01"), by = "month")
dataMonthZoo <- zoo(data1, dateZoo)
dataQuartZoo <- aggregate(dataMonthZoo, as.yearqtr, sum)
dataQuartZoo
zooオブジェクトに対してxtsのapply.quarterlyを使う場合:
library(xts)
dataQuartXts <- apply.quarterly(dataMonthZoo, sum)
dataQuartXts# ただし、四半期の日付が2010-03-01 2010-06-01等となって日付がふさわしくない。
# たとえば、以下のようにして日付2010-01-01 2010-04-01等と直す。
time(dataQuartZoo) <- as.Date(as.yearqtr(time(dataQuartZoo)))
dataQuartZoo
#それ以外だとto.quarterlyを使う方法も考えられる。
その他にもRmetricsのtimeSeriesの関数を使うなどのやり方もあると思います。よりエレガントなやり方があったらコメントで教えて下さい。
[参考]
R - Set the first month of each quarter as the index after applying apply.quarterly() - Stack Overflow
http://stackoverflow.com/questions/19352828/set-the-first-month-of-each-quarter-as-the-index-after-applying-apply-quarterly
Kobe.R: Kobe.R #10 xts 時系列の簡単操作
http://kobexr.blogspot.jp/2014/10/kober-10-xts.html