forecasting - forecast with R -


i have daily data of dengue index january 2010 july 2015:

date    dengue_index 1/1/2010    0.169194109 1/2/2010    0.172350434 1/3/2010    0.174939783 1/4/2010    0.176244642 1/5/2010    0.176658068 1/6/2010    0.177815751 1/7/2010    0.17893075 1/8/2010    0.1813232 1/9/2010    0.182199531 1/10/2010   0.185091158 1/11/2010   0.185267748 1/12/2010   0.185894524 1/13/2010   0.18511499 1/14/2010   0.188080728 1/15/2010   0.190019472 …   … 7/20/2015   0.112748885 7/21/2015   0.113246022 7/22/2015   0.111755091 7/23/2015   0.112164176 7/24/2015   0.11429011 7/25/2015   0.113951836 7/26/2015   0.11319131 7/27/2015   0.112918734 

i want predict values until end of 2016 using r.

library(forecast) setwd("...") dengue_series <- read.csv(file="r_wikipedia-googletrends-model.csv",head=true,sep=";") dengue_index <- ts(dengue_series$dengue_index, frequency=7) plot(dengue_index) # lambda=0 -> predict positive values fit <- auto.arima(dengue_index, lambda=0) fit # predict until december 2016 forecast_series <- forecast(fit, 500) forecast_series plot(forecast_series) 

problem: prediction not good! enter image description here

how improve prediction?

link data source: https://www.dropbox.com/s/wnvc4e78t124fkd/r_wikipedia-googletrends-model.csv?dl=0

you can try specifying multi-seasonal time series object msts, , forecasting using tbats. tbats referenced in paper david arenburg mentions in comments.

here's example pulled example data in forecast package taylor dataset, has seasonal periods of 48 half-hour periods in day, , 336 half hour periods in week (i.e. 336 / 48 = 7).

x <- msts(taylor, seasonal.periods=c(48,336), ts.frequency=48, start=2000+22/52) fit <- tbats(x) fc <- forecast(fit)  # not shown, forecast seems capture both seasonal patterns plot(fc) 

also see http://users.ox.ac.uk/~mast0315/compareunivload.pdf additional info on taylor

for data set daily data , daily/monthly seasonal pattern, perhaps

tsdat <- msts(dat, seasonal.periods=c(7, 84), ts.frequency=7, start=2010) 

or

 tsdat <- msts(dat, seasonal.periods=c(7, 365.25), ts.frequency=7, start=2010) 

edit

using provided data, looks decent forecast daily/weekly seasonality.

data <- read.table("r_wikipedia-googletrends-model.csv", header=true, sep=";") dengue_index <- msts(data$dengue_index, seasonal.periods=c(7, 365), ts.frequency=7) fit <- tbats(dengue_index)  fc <- forecast(fit) plot(fc) 

enter image description here


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -