[R] hourly prediction time series

Sean Porter sporter at ori.org.za
Fri Feb 5 10:18:29 CET 2016


Try the auto.arima function in the forecast package..

Regards,
 
DR SEAN PORTER
Scientist

South African Association for Marine Biological Research
Direct Tel: +27 (31) 328 8169   Fax: +27 (31) 328 8188
E-mail: sporter at ori.org.za Web: www.saambr.org.za
1 King Shaka Avenue, Point, Durban 4001 KwaZulu-Natal South Africa
PO Box 10712, Marine Parade 4056 KwaZulu-Natal South Africa

         


-----Original Message-----
From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of AURORA GONZALEZ VIDAL
Sent: 05 February 2016 10:50 AM
To: r-help at r-project.org
Subject: [R] hourly prediction time series

Dear R users,

I am fronting my firts time series problem. I have hourly temperature data for 3 years (from 01/01/2013 to 5/02/2016). I would like to use those in order to PREDICT TEMPERATURE OF THE NEXT HOURS according to the observations.

A subset of the data look like this:

date <- rep(seq(as.Date("14-01-01"), as.Date("14-01-03"), by="days"), 24) hour <-rep(c(paste0("0",0:9,":00:00"), paste0(10:23,":00:00")),3) temperature <- c(6.1, 6.8, 6.5, 7.2, 7.1, 7.9, 5.9, 6.8, 7.7, 9.5, 12.6,
                 14.0, 15.9, 17.3, 17.5, 17.2, 15.0, 14.1, 13.1, 11.7, 10.9,
                 11.0, 11.6, 11.0, 11.2, 11.0, 11.0, 11.4, 12.2, 13.7, 12.9,
                 12.9, 12.8, 13.4, 13.9, 14.9, 16.6, 16.0, 15.2, 15.4, 14.7,
                 14.6, 13.3, 13.0, 13.8, 13.1, 12.0, 11.9, 11.8, 11.6, 11.0,
                 11.2, 11.6, 10.6, 9.5, 9.8, 9.9, 11.7, 15.3, 18.6, 20.7,
                 22.2, 22.2, 20.8, 20.2, 18.3, 15.6, 13.6, 12.8, 13.1, 13.7, 14.7)

dfExample <- data.frame(date, hour, temperature) 

So as to plot 3 years ( from 01/01/2013 to 31/12/2015) I use this code and obtained the attached picture. It is observed seasonality.

tempdf4 <- ts(df4$temperature, frequency=365*24*3)
plot.ts(tempdf4)

Am I doing it well? Could you help me with any information in this type of problem (mainly with the prediction). For example, if I want to use Arima, according with my data structure, what are the arguments of the funcion??

fit=Arima(df4$temperature, seasonal=list(order=c(xxx,xxx,xxx),period=xxx)
plot(forecast(fit))

I could use also some predictions from other source that I am collecting since January, 2016. But I would prefer to understand the simplest way to solve the problem and then, progressively, understand more complex approaches.

Thank you very much for any kind of help.


------
Aurora González Vidal
Phd student in Data Analytics for Energy Efficiency

Faculty of Computer Sciences
University of Murcia

@. aurora.gonzalez2 at um.es
T. 868 88 7866
www.um.es/ae



More information about the R-help mailing list