Nile(datasets)
Nile()所属R语言包:datasets
Flow of the River Nile
尼罗河的流量
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Measurements of the annual flow of the river Nile at Ashwan 1871–1970.
Ashwan 1871年至1970年在尼罗河的年径流量的测量。
用法----------Usage----------
格式----------Format----------
A time series of length 100.
时间序列的长度为100。
源----------Source----------
Durbin, J. and Koopman, S. J. (2001) Time Series Analysis by State Space Methods. Oxford University Press. http://www.ssfpack.com/DKbook.html
德宾,研究和考夫曼,SJ(2001)状态空间法的时间序列分析。牛津大学出版社。 http://www.ssfpack.com/DKbook.html
参考文献----------References----------
Journal of Business and Economic Statistics 11, 81–92.
change-point problem. Biometrika 65, 243–51.
举例----------Examples----------
require(stats); require(graphics)
par(mfrow = c(2,2))
plot(Nile)
acf(Nile)
pacf(Nile)
ar(Nile) # selects order 2[选择2阶]
cpgram(ar(Nile)$resid)
par(mfrow = c(1,1))
arima(Nile, c(2, 0, 0))
## Now consider missing values, following Durbin & Koopman[#现在考虑遗漏值后,德宾与库普曼]
NileNA <- Nile
NileNA[c(21:40, 61:80)] <- NA
arima(NileNA, c(2, 0, 0))
plot(NileNA)
pred <-
predict(arima(window(NileNA, 1871, 1890), c(2,0,0)), n.ahead = 20)
lines(pred$pred, lty = 3, col = "red")
lines(pred$pred + 2*pred$se, lty=2, col="blue")
lines(pred$pred - 2*pred$se, lty=2, col="blue")
pred <-
predict(arima(window(NileNA, 1871, 1930), c(2,0,0)), n.ahead = 20)
lines(pred$pred, lty = 3, col = "red")
lines(pred$pred + 2*pred$se, lty=2, col="blue")
lines(pred$pred - 2*pred$se, lty=2, col="blue")
## Structural time series models[#结构时间序列模型]
par(mfrow = c(3, 1))
plot(Nile)
## local level model[#地方级模型]
(fit <- StructTS(Nile, type = "level"))
lines(fitted(fit), lty = 2) # contemporaneous smoothing[同期平滑]
lines(tsSmooth(fit), lty = 2, col = 4) # fixed-interval smoothing[固定区间平滑]
plot(residuals(fit)); abline(h = 0, lty = 3)
## local trend model[#本地趋势模型]
(fit2 <- StructTS(Nile, type = "trend")) ## constant trend fitted[#不变的趋势拟合]
pred <- predict(fit, n.ahead = 30)
## with 50% confidence interval[#与50%的置信区间]
ts.plot(Nile, pred$pred,
pred$pred + 0.67*pred$se, pred$pred -0.67*pred$se)
## Now consider missing values[#现在考虑遗漏值]
plot(NileNA)
(fit3 <- StructTS(NileNA, type = "level"))
lines(fitted(fit3), lty = 2)
lines(tsSmooth(fit3), lty = 3)
plot(residuals(fit3)); abline(h = 0, lty = 3)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|