Tag: holtwitter

R:通过数据框的多列运行预测function

我用csv文件读入一个dataframe,使用: dataxlsx <- read.csv(file.choose(), header = T) 数据框如下所示: Year Month Period X410 X430 X431 2005 1 1 3467748 4434879 1345638 2005 2 2 3626338 4311150 1167523 . . . . . . 2015 7 127 2374105 1514540 1399804 我试图运行我创build的名为HWplot的函数来预测input的数据并运行预测,并输出预测图。 我用包ggplot2,tseries,预测。 HWplot <- function(dataxlsx, n.ahead=12, CI=.95, error.ribbon='green', line.size=1) { hw_object<-HoltWinters(dataxlsx) forecast<-predict(hw_object, n.ahead=24, prediction.interval=T, level=0.95) for_values<-data.frame(time=round(time(forecast), 3), […]