Last active
April 12, 2016 06:00
-
-
Save dragstar328/f47ecc52ece3c41af2530a2a7f1ce7d1 to your computer and use it in GitHub Desktop.
温度をARIMA時系列分析
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(forecast) | |
# データ読み込み | |
d = read.csv("temp.csv") | |
# unixtimeをPOSIXctに変換 | |
tsPOSIX = as.POSIXct(d[,1], origin="1970-01-01") | |
d = cbind(tsPOSIX, d) | |
colnames(d)[1] = "ts" | |
head(d) | |
tail(d) | |
# auto.arimaを使って時系列分析 | |
d.arima = auto.arima(d[, 2], stepwise = T, trace=T) | |
# 100期先まで予測する | |
d.arima.forecast = forecast(d.arima, level=c(50,95), h = 100) | |
# 予測値をプロット | |
plot(d.arima.forecast) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment