Time series and regression presentation for oct 5th rice presentation r group

16
Example Time Series & Multivariate Regression in R - Predicting Steel Demand

description

Short presentation on multivariate regression and time series regression using the open source package R

Transcript of Time series and regression presentation for oct 5th rice presentation r group

Page 1: Time series and regression presentation for oct 5th rice presentation r group

Example Time Series & Multivariate Regression in R -

Predicting Steel Demand

Example Time Series & Multivariate Regression in R -

Predicting Steel Demand

Page 2: Time series and regression presentation for oct 5th rice presentation r group

Time Series Time Series

• The math is pretty substantial (at least for me!)

• Key concepts are seasonality, auto-regression, trend and level

• We used Holt-Winters and ARIMA (auto regression integrated moving average); plenty of other functions exist

Page 3: Time series and regression presentation for oct 5th rice presentation r group

Client management wants to predict demand (in tons) of steel

Client management wants to predict demand (in tons) of steel

Page 4: Time series and regression presentation for oct 5th rice presentation r group

Some HW CodeSome HW Code

Page 5: Time series and regression presentation for oct 5th rice presentation r group

Prediction Prediction

Page 6: Time series and regression presentation for oct 5th rice presentation r group

ARIMAARIMA

• “Seasonal ARIMA modelsare powerful tools in the analysis of time series as they are capable of modeling a very wide range of series”

• Best to learn thoroughly and from deep study. But if you have a day job …. Just pluck code to optimize the parameters and use it

Page 7: Time series and regression presentation for oct 5th rice presentation r group

Here’s the code for selecting the best ARIMA parameters

Here’s the code for selecting the best ARIMA parameters

Page 8: Time series and regression presentation for oct 5th rice presentation r group

Multivariate RegressionMultivariate Regression

• Identified about 150 economic indicators; from economy.com and other sources.

Page 9: Time series and regression presentation for oct 5th rice presentation r group

1 response; 150 predictors – tedious to find best COR

1 response; 150 predictors – tedious to find best COR

Page 10: Time series and regression presentation for oct 5th rice presentation r group

Now we know top ten predictors for agriculture – let’s build a model

Now we know top ten predictors for agriculture – let’s build a model

Page 11: Time series and regression presentation for oct 5th rice presentation r group

Whack a mole on predictorsWhack a mole on predictors

Page 12: Time series and regression presentation for oct 5th rice presentation r group

Get a nice modelGet a nice model

Page 13: Time series and regression presentation for oct 5th rice presentation r group

Remembering why we walked into the swamp … oh yea, to predict future tons for agriculture products

Remembering why we walked into the swamp … oh yea, to predict future tons for agriculture products

Page 14: Time series and regression presentation for oct 5th rice presentation r group

Another approachAnother approach

• You can “lag” your predictors so that – for example - when you build your model, you associate July 2011 actual (response) with April of 2011 predictor value. If you have a good model, lagging allows you to predict future values without depending on “experts” to opine on future economic indicators.

Page 15: Time series and regression presentation for oct 5th rice presentation r group

Simple code to “lag” Simple code to “lag”

R has a

Built in

Lag function

Page 16: Time series and regression presentation for oct 5th rice presentation r group

If you want a copy of slides or code, just email me.

If you want a copy of slides or code, just email me.

Bill Yarberry

[email protected]

Thanks.