国際収支

国際収支

1.日本銀行HPのデータを使う

  • (1)使用データ
    • ソース:ttp://www.stat-search.boj.or.jp/index.html
    • 期間 1996-2008
    • 月次データ

  • (2)Rによる作図
    • "bojkokusai9608.csv"を読み込む


EXIM <- read.table("bojkokusai9608.csv",sep=",",skip=2)#ファイルの読み込み
x2 <- EXIM[,2]#経常移転 #エックスは2から
x3 <- EXIM[,3]#貿易収支
x4 <- EXIM[,4]#サービス収支
x5 <- EXIM[,5]#所得収支
x6 <- EXIM[,6]#経常
t1 <- ts(x2, start=c(1996,1),frequency=12) #数字をずらす。。
t2 <- ts(x3, start=c(1996,1),frequency=12)
t3 <- ts(x4, start=c(1996,1),frequency=12)
t4 <- ts(x5, start=c(1996,1),frequency=12)
t5 <- ts(x6, start=c(1996,1),frequency=12)

ts.plot(t1,t2,t3,t4,t5,gpars=list(xlab="year", ylab="億円", lty=c(1:5), col=c(1:5)),main="国際収支(fromBOJ:HP)")
#マウスで凡例の場所を選べる

legend(locator(1),c("経常移転","貿易収支","サービス収支","所得収支","経常収支"),lty=c(1:5),col=c(1:5))


  • 結果
  • (3)季節性の確認
    • Rのコード


plot(decompose(t1))
plot(decompose(t2))
plot(decompose(t3))
plot(decompose(t4))
plot(decompose(t5))


2.MOFのデータを使う

  • (1)使用データ
    • ソース:ttp://www.mof.go.jp/bpoffice/bpdata/sbp/s-1/s-1-4.csv
    • 期間 1996-2008
    • 月次データ
  • "mofshihonh08-22.csv"を読み込む
  • ダウンロードしたままなので27行あける。。


mof001 <- read.table("mofshihonh08-22.csv",sep=",",skip=27)#ファイルの読み込み
CA <- mof001[,5]#CurrentAccount
CF <- mof001[,13]#Capital & Financial Account
RA <- mof001[,16]#Chages in Reserve Assets
EO <- mof001[,17]#Errors & Omissions

CAT <- ts(CA, start=c(1996,1),frequency=12)
CFT <- ts(CF, start=c(1996,1),frequency=12)
RAT <- ts(RA, start=c(1996,1),frequency=12)
EOT <- ts(EO, start=c(1996,1),frequency=12)

#これだと見づらい
ts.plot(CAT,CFT,RAT,EOT,gpars=list(xlab="year", ylab="100 million Yen", lty=c(1:4), col=c(1:4)),main="資本収支(from MOF:HP)")

par(mfrow=c(2,2))#4グラフを1画面に導出
ts.plot(CAT,xlab='yr',ylab='100 million Yen',main="CurrentAccount")
ts.plot(CFT,xlab='yr',ylab='100 million Yen',main="Capital & Financial Account")
ts.plot(RAT,xlab='yr',ylab='100 million Yen',main="Chages in Reserve Assets")
ts.plot(EOT,xlab='yr',ylab='100 million Yen',main="Errors & Omissions")

最終更新:2010年07月14日 13:00