SlideShare una empresa de Scribd logo
1 de 14
Time Series Analysis & fpp
• Used to predict wind speeds at forecast horizons of 10
minutes to 1 day ahead, based on historical wind speeds (10
minute averages).
• Forecast package: Rob Hyndman
• https://www.otexts.org/fpp - good explanations and worked
examples.
1
Fiona McGroarty
Dublin R 24/03/2016
Time Series Data
• Forecasting extrapolates trend and seasonal patterns.
• Trend : long term increased/decrease.
• Seasonal: e.g. daily
weekly, yearly (fixed
& known length).
• Cycle: rises/falls that
are not a fixed period
(variable & unknown
length).
Trend: Generally increasing
Seasonal Pattern: Sharp rise at the
end of each year (stockpiling)
• Observations (at regular intervals) sequentially over time.
2
Fiona McGroarty
Dublin R 24/03/2016
Autocorrelations
• Correlation: lags 4 & 8 –
seasonal pattern, peaks are
4 quarters apart.
• Linear relationship between
lagged values of a time series
(quarterly beer production):
Lag.plot(beer2, lags=9).
• Corr. Coefficient -1 ≤ r ≤ 1.
• Correlation: lags 2 & 6 –
troughs are 2 quarters
behind peaks.
3
Fiona McGroarty
Dublin R 24/03/2016
Autocorrelations
• Plot ACF (acf(beer2)):
• White Noise: 95% of spikes
are within ±2/T (T = length
of time series=50).
4
Fiona McGroarty
Dublin R 24/03/2016
Autocorrelations
• Plot ACF (acf(beer2)):
• White Noise: 95% of spikes
are within ±2/T (T = length
of time series=50).
5
Fiona McGroarty
Dublin R 24/03/2016
Simple Forecasts (Benchmarks)
• Naïve method: forecast = value of last observation:
naive(beer2, h=11) or rwf(beer2, h=11).
• Average method: forecast = mean of historical data:
meanf(beer2, h=11).
• Seasonal naïve: forecast = value of last observation from the
previous season
(month/quarter/year ...)
snaive(beer2, h=11).
6
Fiona McGroarty
Dublin R 24/03/2016
Simple Forecasts (Benchmarks)
• Drift: variation on naïve, allow forecast to increase/decrease
over time: rwf (dj2, h=42, drift=TRUE)
7
Fiona McGroarty
Dublin R 24/03/2016
Time Series Decomposition
• fit <- stl (elecequip,
t.window=15,
s.window=“periodic”,
robust=TRUE).
Plot(fit).
• Time series decomposition: yt = St + Tt + Et or yt = St × Tt × Et
Electrical equipment orders. (Seasonal, Trend, Error)
• Set trend window and seasonal
window sizes – small values
allow more rapid changes.
8
Fiona McGroarty
Dublin R 24/03/2016
Forecast: ETS
• Effects of components can be additive (A), multiplicative (M) or
ignored (N, none). EG ETS (MAN) forecasts by multiplying errors
(M), adding trends (A) and ignoring seasonal effects (N).
SES: Simple Exponential Smoothing
Holts Linear Method
Additive Holts-Winter Method
Multiplicative Holts-Winter Method
Holts-Winter damped method
• ETS (ANN) SES with + errors; ETS (MNN) SES with × errors.
• Some are numerically unstable e.g. if data contains 0 or neg. values.
• ETS(ZZZ) – runs all (stable) ETS models and returns the optimal one.
• ETS (Error, Trend, Seasonal OR ExponenTial Smoothing)
9
Fiona McGroarty
Dublin R 24/03/2016
EG: Forecasts using Holt’s method
10
Fiona McGroarty
Dublin R 24/03/2016
Forecast: ETS
• oildata <- window(oil, start=1996,end=2007)
fit <- ets(oildata, model=“ANN”)
plot(forecast(fit, h=3), ylab=“Oil (millions of tonnes)”)
• Point forecasts and 80% and 95% prediction intervals.
11
Fiona McGroarty
Dublin R 24/03/2016
ARIMA Models
• ARIMA (p, d, q) e.g. ARIMA101 model uses one past time-
lagged wind speed autocorrelation term (p = 1), is not
differentiated (d = 0) and uses one past forecast error (q = 1).
• ARIMA = Auto Regression (detects similarity in the data using
timelagged values of the variable) Integrated (the data may
have to be differentiated a number of times to make it
stationary) Moving Average (using weighted moving average
of the past few forecast errors).
• Can specify the ARIMA (p, d, q) model to use, or use
auto.arima
12
Fiona McGroarty
Dublin R 24/03/2016
ARIMA Models
• fit <- auto.arima (usconsumption[,1], seasonal=FALSE
plot(forecast(fit, h=10), include=80)
• Best ARIMA model is returned, in this case it’s ARIMA(0,0,3).
• fit <- Arima(usconsumption[,1], order=c(0,0,3))
13
Fiona McGroarty
Dublin R 24/03/2016
Lots of other things to consider….
• Stationarity of data
• Transforming data before forecasting – differentiating…
• Error Metrics! Calculate MAE, RMSE,…..
14
Fiona McGroarty
Dublin R 24/03/2016

Más contenido relacionado

La actualidad más candente

Hydrology/Hydraulic Model for South Boston CSO Project
Hydrology/Hydraulic Model for South Boston CSO Project Hydrology/Hydraulic Model for South Boston CSO Project
Hydrology/Hydraulic Model for South Boston CSO Project
dingfangliu
 
New Microsoft Word Document
New Microsoft Word DocumentNew Microsoft Word Document
New Microsoft Word Document
Farhan Shariff
 
SAS writing example
SAS writing exampleSAS writing example
SAS writing example
Tianyue Wang
 
MFord SSIE598 MRP v Lean
MFord SSIE598 MRP v LeanMFord SSIE598 MRP v Lean
MFord SSIE598 MRP v Lean
Michael Ford
 
Use of the German Weather Services KLAM Model to Investigate the Cold Air Dra...
Use of the German Weather Services KLAM Model to Investigate the Cold Air Dra...Use of the German Weather Services KLAM Model to Investigate the Cold Air Dra...
Use of the German Weather Services KLAM Model to Investigate the Cold Air Dra...
IES / IAQM
 

La actualidad más candente (19)

CLIWOC Attributes
CLIWOC AttributesCLIWOC Attributes
CLIWOC Attributes
 
2. 8085 introduction to instruction
2. 8085 introduction to instruction2. 8085 introduction to instruction
2. 8085 introduction to instruction
 
Petrel course
Petrel coursePetrel course
Petrel course
 
The Analogues R-Package - Ramirez-Villegas
The Analogues R-Package - Ramirez-VillegasThe Analogues R-Package - Ramirez-Villegas
The Analogues R-Package - Ramirez-Villegas
 
A non-interpolating semi-Lagrangian scheme for the continuity equation of the...
A non-interpolating semi-Lagrangian scheme for the continuity equation of the...A non-interpolating semi-Lagrangian scheme for the continuity equation of the...
A non-interpolating semi-Lagrangian scheme for the continuity equation of the...
 
Hydrology/Hydraulic Model for South Boston CSO Project
Hydrology/Hydraulic Model for South Boston CSO Project Hydrology/Hydraulic Model for South Boston CSO Project
Hydrology/Hydraulic Model for South Boston CSO Project
 
Class lectures on Hydrology by Rabindra Ranjan Saha Lecture 4
Class lectures on Hydrology by Rabindra Ranjan Saha  Lecture 4Class lectures on Hydrology by Rabindra Ranjan Saha  Lecture 4
Class lectures on Hydrology by Rabindra Ranjan Saha Lecture 4
 
Future up-gradations to Flood Warning Systems in Assam
Future up-gradations to Flood Warning Systems in AssamFuture up-gradations to Flood Warning Systems in Assam
Future up-gradations to Flood Warning Systems in Assam
 
c
cc
c
 
Class lectures on Hydrology by Rabindra Ranjan Saha Lecture 9
Class lectures on Hydrology by Rabindra Ranjan Saha Lecture 9Class lectures on Hydrology by Rabindra Ranjan Saha Lecture 9
Class lectures on Hydrology by Rabindra Ranjan Saha Lecture 9
 
Nwp performance gonu Tropical Cyclone conference
Nwp performance gonu Tropical Cyclone conferenceNwp performance gonu Tropical Cyclone conference
Nwp performance gonu Tropical Cyclone conference
 
New Microsoft Word Document
New Microsoft Word DocumentNew Microsoft Word Document
New Microsoft Word Document
 
SAS writing example
SAS writing exampleSAS writing example
SAS writing example
 
MFord SSIE598 MRP v Lean
MFord SSIE598 MRP v LeanMFord SSIE598 MRP v Lean
MFord SSIE598 MRP v Lean
 
Italian weather type
Italian weather typeItalian weather type
Italian weather type
 
Use of the German Weather Services KLAM Model to Investigate the Cold Air Dra...
Use of the German Weather Services KLAM Model to Investigate the Cold Air Dra...Use of the German Weather Services KLAM Model to Investigate the Cold Air Dra...
Use of the German Weather Services KLAM Model to Investigate the Cold Air Dra...
 
Class lectures on Hydrology by Rabindra Ranjan Saha Lecture 12
Class lectures on Hydrology by Rabindra Ranjan Saha Lecture 12Class lectures on Hydrology by Rabindra Ranjan Saha Lecture 12
Class lectures on Hydrology by Rabindra Ranjan Saha Lecture 12
 
Hydrocarbon estimation methods
Hydrocarbon estimation methodsHydrocarbon estimation methods
Hydrocarbon estimation methods
 
Wimax
WimaxWimax
Wimax
 

Destacado

Time series analysis of collaborative activities-CRIWG2012
Time series analysis of collaborative activities-CRIWG2012Time series analysis of collaborative activities-CRIWG2012
Time series analysis of collaborative activities-CRIWG2012
Irene-Angelica Chounta
 
Scipy 2011 Time Series Analysis in Python
Scipy 2011 Time Series Analysis in PythonScipy 2011 Time Series Analysis in Python
Scipy 2011 Time Series Analysis in Python
Wes McKinney
 
Lecture 13 profits and gains from business or profession
Lecture 13   profits and gains from business or professionLecture 13   profits and gains from business or profession
Lecture 13 profits and gains from business or profession
sumit235
 
Lecture 12 income from business and profession
Lecture 12   income from business and professionLecture 12   income from business and profession
Lecture 12 income from business and profession
sumit235
 
Class notes forecasting
Class notes forecastingClass notes forecasting
Class notes forecasting
Arun Kumar
 

Destacado (20)

Introduction to RapidMiner Studio V7
Introduction to RapidMiner Studio V7Introduction to RapidMiner Studio V7
Introduction to RapidMiner Studio V7
 
Sales forecasting & planing training
Sales forecasting & planing trainingSales forecasting & planing training
Sales forecasting & planing training
 
PyDataDC- Forecasting critical food violations at restaurants using open data
PyDataDC- Forecasting critical food violations at restaurants using open dataPyDataDC- Forecasting critical food violations at restaurants using open data
PyDataDC- Forecasting critical food violations at restaurants using open data
 
ForecastIT 4. Holt's Exponential Smoothing
ForecastIT 4. Holt's Exponential SmoothingForecastIT 4. Holt's Exponential Smoothing
ForecastIT 4. Holt's Exponential Smoothing
 
Time series analysis of collaborative activities-CRIWG2012
Time series analysis of collaborative activities-CRIWG2012Time series analysis of collaborative activities-CRIWG2012
Time series analysis of collaborative activities-CRIWG2012
 
Forecasting Techniques - Data Science SG
Forecasting Techniques - Data Science SG Forecasting Techniques - Data Science SG
Forecasting Techniques - Data Science SG
 
Anomaly detection
Anomaly detectionAnomaly detection
Anomaly detection
 
Time series and forecasting from wikipedia
Time series and forecasting from wikipediaTime series and forecasting from wikipedia
Time series and forecasting from wikipedia
 
Trend adjusted exponential smoothing forecasting metho ds
Trend adjusted exponential smoothing forecasting metho dsTrend adjusted exponential smoothing forecasting metho ds
Trend adjusted exponential smoothing forecasting metho ds
 
Bba 1584 planning n forecasting
Bba 1584 planning n forecastingBba 1584 planning n forecasting
Bba 1584 planning n forecasting
 
Scipy 2011 Time Series Analysis in Python
Scipy 2011 Time Series Analysis in PythonScipy 2011 Time Series Analysis in Python
Scipy 2011 Time Series Analysis in Python
 
Lecture 13 profits and gains from business or profession
Lecture 13   profits and gains from business or professionLecture 13   profits and gains from business or profession
Lecture 13 profits and gains from business or profession
 
Forecasting-Exponential Smoothing
Forecasting-Exponential SmoothingForecasting-Exponential Smoothing
Forecasting-Exponential Smoothing
 
Lecture 12 income from business and profession
Lecture 12   income from business and professionLecture 12   income from business and profession
Lecture 12 income from business and profession
 
demand forecasting
demand forecastingdemand forecasting
demand forecasting
 
Linear programing
Linear programingLinear programing
Linear programing
 
Class notes forecasting
Class notes forecastingClass notes forecasting
Class notes forecasting
 
Statistical Learning Based Anomaly Detection @ Twitter
Statistical Learning Based Anomaly Detection @ TwitterStatistical Learning Based Anomaly Detection @ Twitter
Statistical Learning Based Anomaly Detection @ Twitter
 
CTDM: 7Th semester : Unit 2 decision theory
CTDM: 7Th semester  : Unit 2   decision theoryCTDM: 7Th semester  : Unit 2   decision theory
CTDM: 7Th semester : Unit 2 decision theory
 
[devil's camp] - 알고리즘 대회와 STL (박인서)
[devil's camp] - 알고리즘 대회와 STL (박인서)[devil's camp] - 알고리즘 대회와 STL (박인서)
[devil's camp] - 알고리즘 대회와 STL (박인서)
 

Similar a Time series Analysis & fpp package

Download-manuals-surface water-waterlevel-40howtocompiledischargedata
 Download-manuals-surface water-waterlevel-40howtocompiledischargedata Download-manuals-surface water-waterlevel-40howtocompiledischargedata
Download-manuals-surface water-waterlevel-40howtocompiledischargedata
hydrologyproject001
 
Jaya r pudashine
Jaya r pudashineJaya r pudashine
Jaya r pudashine
ClimDev15
 
ICLR Friday Forum: Updating IDF curves for future climate (March 24, 2017)
ICLR Friday Forum: Updating IDF curves for future climate (March 24, 2017)ICLR Friday Forum: Updating IDF curves for future climate (March 24, 2017)
ICLR Friday Forum: Updating IDF curves for future climate (March 24, 2017)
glennmcgillivray
 
Carlos N - CIAT Experience In Climate Modeling; Scenarios of future climate c...
Carlos N - CIAT Experience In Climate Modeling; Scenarios of future climate c...Carlos N - CIAT Experience In Climate Modeling; Scenarios of future climate c...
Carlos N - CIAT Experience In Climate Modeling; Scenarios of future climate c...
Decision and Policy Analysis Program
 
Download-manuals-hydrometeorology-data processing-10howtocorrectandcompleter...
 Download-manuals-hydrometeorology-data processing-10howtocorrectandcompleter... Download-manuals-hydrometeorology-data processing-10howtocorrectandcompleter...
Download-manuals-hydrometeorology-data processing-10howtocorrectandcompleter...
hydrologyproject001
 
Download-manuals-hydrometeorology-data processing-10howtocorrectandcompleter...
 Download-manuals-hydrometeorology-data processing-10howtocorrectandcompleter... Download-manuals-hydrometeorology-data processing-10howtocorrectandcompleter...
Download-manuals-hydrometeorology-data processing-10howtocorrectandcompleter...
hydrologyproject001
 

Similar a Time series Analysis & fpp package (20)

Conventional & Unconventional Reservoirs.pdf
Conventional & Unconventional Reservoirs.pdfConventional & Unconventional Reservoirs.pdf
Conventional & Unconventional Reservoirs.pdf
 
Forecasting_CO2_Emissions.pptx
Forecasting_CO2_Emissions.pptxForecasting_CO2_Emissions.pptx
Forecasting_CO2_Emissions.pptx
 
Pressure & Rate Transient Analysis.pdf
Pressure & Rate Transient Analysis.pdfPressure & Rate Transient Analysis.pdf
Pressure & Rate Transient Analysis.pdf
 
Javier Garcia - Verdugo Sanchez - Six Sigma Training - W2 Multi - vari Studies
Javier Garcia - Verdugo Sanchez - Six Sigma Training - W2 Multi - vari StudiesJavier Garcia - Verdugo Sanchez - Six Sigma Training - W2 Multi - vari Studies
Javier Garcia - Verdugo Sanchez - Six Sigma Training - W2 Multi - vari Studies
 
Demand time series analysis and forecasting
Demand time series analysis and forecastingDemand time series analysis and forecasting
Demand time series analysis and forecasting
 
Download-manuals-surface water-waterlevel-40howtocompiledischargedata
 Download-manuals-surface water-waterlevel-40howtocompiledischargedata Download-manuals-surface water-waterlevel-40howtocompiledischargedata
Download-manuals-surface water-waterlevel-40howtocompiledischargedata
 
Abdel1
Abdel1Abdel1
Abdel1
 
Ecm time series forecast
Ecm time series forecastEcm time series forecast
Ecm time series forecast
 
Comparison of wepp and apex runoff
Comparison of wepp and apex runoffComparison of wepp and apex runoff
Comparison of wepp and apex runoff
 
Francisco J. Doblas-Big Data y cambio climático
Francisco J. Doblas-Big Data y cambio climáticoFrancisco J. Doblas-Big Data y cambio climático
Francisco J. Doblas-Big Data y cambio climático
 
MLOS forecasting
MLOS forecastingMLOS forecasting
MLOS forecasting
 
Jaya r pudashine
Jaya r pudashineJaya r pudashine
Jaya r pudashine
 
Statistical downscaling sdsm
Statistical downscaling sdsmStatistical downscaling sdsm
Statistical downscaling sdsm
 
Navarro C - Results Climate Projection Development (CIAT-IDB Project)
Navarro C - Results Climate Projection Development (CIAT-IDB Project) Navarro C - Results Climate Projection Development (CIAT-IDB Project)
Navarro C - Results Climate Projection Development (CIAT-IDB Project)
 
ICLR Friday Forum: Updating IDF curves for future climate (March 24, 2017)
ICLR Friday Forum: Updating IDF curves for future climate (March 24, 2017)ICLR Friday Forum: Updating IDF curves for future climate (March 24, 2017)
ICLR Friday Forum: Updating IDF curves for future climate (March 24, 2017)
 
Carlos N - CIAT Experience In Climate Modeling; Scenarios of future climate c...
Carlos N - CIAT Experience In Climate Modeling; Scenarios of future climate c...Carlos N - CIAT Experience In Climate Modeling; Scenarios of future climate c...
Carlos N - CIAT Experience In Climate Modeling; Scenarios of future climate c...
 
Genealized Diagonal band copula wifth two-sided power densities
Genealized Diagonal band copula wifth two-sided power densitiesGenealized Diagonal band copula wifth two-sided power densities
Genealized Diagonal band copula wifth two-sided power densities
 
Uncertainty in simulating biomass yield and carbon-water fluxes from Euro-Med...
Uncertainty in simulating biomass yield and carbon-water fluxes from Euro-Med...Uncertainty in simulating biomass yield and carbon-water fluxes from Euro-Med...
Uncertainty in simulating biomass yield and carbon-water fluxes from Euro-Med...
 
Download-manuals-hydrometeorology-data processing-10howtocorrectandcompleter...
 Download-manuals-hydrometeorology-data processing-10howtocorrectandcompleter... Download-manuals-hydrometeorology-data processing-10howtocorrectandcompleter...
Download-manuals-hydrometeorology-data processing-10howtocorrectandcompleter...
 
Download-manuals-hydrometeorology-data processing-10howtocorrectandcompleter...
 Download-manuals-hydrometeorology-data processing-10howtocorrectandcompleter... Download-manuals-hydrometeorology-data processing-10howtocorrectandcompleter...
Download-manuals-hydrometeorology-data processing-10howtocorrectandcompleter...
 

Último

Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
amitlee9823
 
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
amitlee9823
 
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
amitlee9823
 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
AroojKhan71
 
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts ServiceCall Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
amitlee9823
 
Probability Grade 10 Third Quarter Lessons
Probability Grade 10 Third Quarter LessonsProbability Grade 10 Third Quarter Lessons
Probability Grade 10 Third Quarter Lessons
JoseMangaJr1
 
Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
amitlee9823
 

Último (20)

Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFx
 
ALSO dropshipping via API with DroFx.pptx
ALSO dropshipping via API with DroFx.pptxALSO dropshipping via API with DroFx.pptx
ALSO dropshipping via API with DroFx.pptx
 
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
 
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort ServiceBDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
 
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% SecureCall me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
 
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
 
April 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's AnalysisApril 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's Analysis
 
Sampling (random) method and Non random.ppt
Sampling (random) method and Non random.pptSampling (random) method and Non random.ppt
Sampling (random) method and Non random.ppt
 
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
 
Discover Why Less is More in B2B Research
Discover Why Less is More in B2B ResearchDiscover Why Less is More in B2B Research
Discover Why Less is More in B2B Research
 
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts ServiceCall Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
 
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signals
 
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
 
Probability Grade 10 Third Quarter Lessons
Probability Grade 10 Third Quarter LessonsProbability Grade 10 Third Quarter Lessons
Probability Grade 10 Third Quarter Lessons
 
Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
 
BabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxBabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptx
 
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 nightCheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
 
Predicting Loan Approval: A Data Science Project
Predicting Loan Approval: A Data Science ProjectPredicting Loan Approval: A Data Science Project
Predicting Loan Approval: A Data Science Project
 

Time series Analysis & fpp package

  • 1. Time Series Analysis & fpp • Used to predict wind speeds at forecast horizons of 10 minutes to 1 day ahead, based on historical wind speeds (10 minute averages). • Forecast package: Rob Hyndman • https://www.otexts.org/fpp - good explanations and worked examples. 1 Fiona McGroarty Dublin R 24/03/2016
  • 2. Time Series Data • Forecasting extrapolates trend and seasonal patterns. • Trend : long term increased/decrease. • Seasonal: e.g. daily weekly, yearly (fixed & known length). • Cycle: rises/falls that are not a fixed period (variable & unknown length). Trend: Generally increasing Seasonal Pattern: Sharp rise at the end of each year (stockpiling) • Observations (at regular intervals) sequentially over time. 2 Fiona McGroarty Dublin R 24/03/2016
  • 3. Autocorrelations • Correlation: lags 4 & 8 – seasonal pattern, peaks are 4 quarters apart. • Linear relationship between lagged values of a time series (quarterly beer production): Lag.plot(beer2, lags=9). • Corr. Coefficient -1 ≤ r ≤ 1. • Correlation: lags 2 & 6 – troughs are 2 quarters behind peaks. 3 Fiona McGroarty Dublin R 24/03/2016
  • 4. Autocorrelations • Plot ACF (acf(beer2)): • White Noise: 95% of spikes are within ±2/T (T = length of time series=50). 4 Fiona McGroarty Dublin R 24/03/2016
  • 5. Autocorrelations • Plot ACF (acf(beer2)): • White Noise: 95% of spikes are within ±2/T (T = length of time series=50). 5 Fiona McGroarty Dublin R 24/03/2016
  • 6. Simple Forecasts (Benchmarks) • Naïve method: forecast = value of last observation: naive(beer2, h=11) or rwf(beer2, h=11). • Average method: forecast = mean of historical data: meanf(beer2, h=11). • Seasonal naïve: forecast = value of last observation from the previous season (month/quarter/year ...) snaive(beer2, h=11). 6 Fiona McGroarty Dublin R 24/03/2016
  • 7. Simple Forecasts (Benchmarks) • Drift: variation on naïve, allow forecast to increase/decrease over time: rwf (dj2, h=42, drift=TRUE) 7 Fiona McGroarty Dublin R 24/03/2016
  • 8. Time Series Decomposition • fit <- stl (elecequip, t.window=15, s.window=“periodic”, robust=TRUE). Plot(fit). • Time series decomposition: yt = St + Tt + Et or yt = St × Tt × Et Electrical equipment orders. (Seasonal, Trend, Error) • Set trend window and seasonal window sizes – small values allow more rapid changes. 8 Fiona McGroarty Dublin R 24/03/2016
  • 9. Forecast: ETS • Effects of components can be additive (A), multiplicative (M) or ignored (N, none). EG ETS (MAN) forecasts by multiplying errors (M), adding trends (A) and ignoring seasonal effects (N). SES: Simple Exponential Smoothing Holts Linear Method Additive Holts-Winter Method Multiplicative Holts-Winter Method Holts-Winter damped method • ETS (ANN) SES with + errors; ETS (MNN) SES with × errors. • Some are numerically unstable e.g. if data contains 0 or neg. values. • ETS(ZZZ) – runs all (stable) ETS models and returns the optimal one. • ETS (Error, Trend, Seasonal OR ExponenTial Smoothing) 9 Fiona McGroarty Dublin R 24/03/2016
  • 10. EG: Forecasts using Holt’s method 10 Fiona McGroarty Dublin R 24/03/2016
  • 11. Forecast: ETS • oildata <- window(oil, start=1996,end=2007) fit <- ets(oildata, model=“ANN”) plot(forecast(fit, h=3), ylab=“Oil (millions of tonnes)”) • Point forecasts and 80% and 95% prediction intervals. 11 Fiona McGroarty Dublin R 24/03/2016
  • 12. ARIMA Models • ARIMA (p, d, q) e.g. ARIMA101 model uses one past time- lagged wind speed autocorrelation term (p = 1), is not differentiated (d = 0) and uses one past forecast error (q = 1). • ARIMA = Auto Regression (detects similarity in the data using timelagged values of the variable) Integrated (the data may have to be differentiated a number of times to make it stationary) Moving Average (using weighted moving average of the past few forecast errors). • Can specify the ARIMA (p, d, q) model to use, or use auto.arima 12 Fiona McGroarty Dublin R 24/03/2016
  • 13. ARIMA Models • fit <- auto.arima (usconsumption[,1], seasonal=FALSE plot(forecast(fit, h=10), include=80) • Best ARIMA model is returned, in this case it’s ARIMA(0,0,3). • fit <- Arima(usconsumption[,1], order=c(0,0,3)) 13 Fiona McGroarty Dublin R 24/03/2016
  • 14. Lots of other things to consider…. • Stationarity of data • Transforming data before forecasting – differentiating… • Error Metrics! Calculate MAE, RMSE,….. 14 Fiona McGroarty Dublin R 24/03/2016