forecast it 2. linear regression & model statistics
TRANSCRIPT
-
8/9/2019 Forecast It 2. Linear Regression & Model Statistics
1/23
Linear Regression and Model Statistics
Lesson #2
Linear Regression Method
Copyright 2010 DeepThought, Inc. 1
-
8/9/2019 Forecast It 2. Linear Regression & Model Statistics
2/23
Linear Regression and Model Statistics
Method Introduction One of the simpler methods to use for forecasting
Estimates a line through the data
Uses the estimated line equation to forecast future values.
Method Format:
Y = a + b * t
Copyright 2010 DeepThought, Inc. 2
-
8/9/2019 Forecast It 2. Linear Regression & Model Statistics
3/23
Linear Regression and Model Statistics
Model Characteristics Method Characteristics
Fits a line to the data
Estimating a line which minimizes the errors between actual
data points and model estimates
When to use Method
Estimate trend
Estimate trend magnitude
When not to use
Estimate anything beyond a simple linear relationship.
Copyright 2010 DeepThought, Inc. 3
-
8/9/2019 Forecast It 2. Linear Regression & Model Statistics
4/23
Linear Regression and Model Statistics
Forecasting Steps1. Objective Setting
2. Method Selection
3. Model Evaluation
4. Find Best Models
5. Use Best Models
Copyright 2010 DeepThought, Inc. 4
-
8/9/2019 Forecast It 2. Linear Regression & Model Statistics
5/23
Linear Regression and Model Statistics
Objective Setting Simpler is better
Linear Regression allows to test whether a line fitted to the data
works as a model. Objectives should take that principal under
consideration.
Example Objectives for M2 Money Stock (see next slide):
Test if M2 has a linear trend over time.
If M2 exhibits a statistically significant trend , what is its
magnitude and does it make sense? If model looks good, Create a forecast based off model.
Copyright 2010 DeepThought, Inc. 5
-
8/9/2019 Forecast It 2. Linear Regression & Model Statistics
6/23
Linear Regression and Model Statistics
Example: M2 Money Stock
0.0
1000.0
2000.0
3000.0
4000.0
5000.0
6000.0
7000.0
8000.0
9000.0
May-79 Nov-84 May-90 Oct-95 Apr-01 Oct-06 Apr-12
M2 Money Stock (Billions of $'s)
Copyright 2010 DeepThought, Inc. 6
-
8/9/2019 Forecast It 2. Linear Regression & Model Statistics
7/23
Linear Regression and Model Statistics
Method Selection Observe time series qualities: trend, seasonality, cyclicality, and
randomness.
Adjust time frame, units, periods to forecast as needed.
Determine if linear regression is a possible candidate based onmethod characteristics.
Determine if transforming the units will enable use of model.
8 Different Unit Transformation Techniques
Copyright 2010 DeepThought, Inc. 7
-
8/9/2019 Forecast It 2. Linear Regression & Model Statistics
8/23
Linear Regression and Model Statistics
Build Model Software finds us the best fit line to the data: (Minimizing the Sum
of Squared Errors)
0.0
1000.0
2000.0
3000.0
4000.0
5000.0
6000.0
7000.0
8000.0
9000.0
May-79 Nov-84 May-90 Oct-95 Apr-01 Oct-06 Apr-12
M2 Money Stock (Billions of $'s)
Copyright 2010 DeepThought, Inc. 8
-
8/9/2019 Forecast It 2. Linear Regression & Model Statistics
9/23
Linear Regression and Model Statistics
Evaluate Model Descriptive Statistics
Mean
Variance & Standard Deviation
Accuracy / Error
SSE
RMSE
MAPE
R-Squared; Adjusted R-Squared
Statistical Significance
F-Test
P-Value F-Test
Copyright 2010 DeepThought, Inc. 9
-
8/9/2019 Forecast It 2. Linear Regression & Model Statistics
10/23
Linear Regression and Model Statistics
Descriptive StatisticsMean
The average value of the data set.
*http://images.google.com/imgres?imgurl=http://www.cs.princeton.edu/introcs/11gaussian/images/stddev.png&imgrefurl=http://ww
w.cs.princeton.edu/introcs/11gaussian/&usg=__7JZMBeSrlQKPfVL2YCVuV8HVXkY=&h=206&w=570&sz=18&hl=en&start=54&um=1&tb
nid=5jb7PXr6kgP08M:&tbnh=48&tbnw=134&prev=/images%3Fq%3Dstandard%2Brandom%2Bdistribution%26ndsp%3D18%26hl%3De
n%26client%3Dfirefox-a%26rls%3Dorg.mozilla:en-US:official%26hs%3DXpO%26sa%3DN%26start%3D36%26um%3D1
Copyright 2010 DeepThought, Inc. 10
-
8/9/2019 Forecast It 2. Linear Regression & Model Statistics
11/23
Linear Regression and Model Statistics
Variance & Standard Deviation The sum of squared deviations of the data from the mean.
Estimates the variation the data exhibits from the mean
Standard Deviation is the squared root of the variance
Used to measure the distribution of the variable away from the
mean, most observations of the variable will be within 3
standard deviations.
Copyright 2010 DeepThought, Inc. 11
-
8/9/2019 Forecast It 2. Linear Regression & Model Statistics
12/23
Linear Regression and Model Statistics
M2 Example Mean
4214.38
Variance
3346475.10
SD (Standard Deviation)
1829.34
0.0
1000.0
2000.0
3000.04000.0
5000.0
6000.0
7000.0
8000.0
9000.0
May-79 Nov-84 May-90 Oct-95 Apr-01 Oct-06 Apr-12
M2 Money Stock (Billions of $'s)
Copyright 2010 DeepThought, Inc. 12
-
8/9/2019 Forecast It 2. Linear Regression & Model Statistics
13/23
Linear Regression and Model Statistics
Accuracy/ErrorSSE
Sum of Square Errors (SSE) Sums the Errors between the actual
values and model values
Measures the total error of the model
M2 Example:
SSE: 316778645.89
0.0
2000.0
4000.0
6000.0
8000.0
10000.0
May-79 Nov-84 May-90 Oct-95 Apr-01 Oct-06 Apr-12
M2 Money Stock (Billions of $'s)
Copyright 2010 DeepThought, Inc. 13
-
8/9/2019 Forecast It 2. Linear Regression & Model Statistics
14/23
Linear Regression and Model Statistics
RMSE
The square root of the sum of square error divided by the number
of observations. An averaged out total of errors based upon the number of
observations.
Simple way to compare models based on error.
M2 Example:
RMSE: 456.82
Copyright 2010 DeepThought, Inc. 14
-
8/9/2019 Forecast It 2. Linear Regression & Model Statistics
15/23
Linear Regression and Model Statistics
MAPE
The average percentage error of the model.
Describes the average percentage of variation exhibited betweenactual and forecasted values.
M2 Example:
MAPE: 10.09%
0.0
2000.0
4000.0
6000.0
8000.0
10000.0
May-79 Nov-84 May-90 Oct-95 Apr-01 Oct-06 Apr-12
M2 Money Stock (Billions of $'s)
Copyright 2010 DeepThought, Inc. 15
-
8/9/2019 Forecast It 2. Linear Regression & Model Statistics
16/23
Linear Regression and Model Statistics
R-Squared & Adjusted R-Squared
A proportion between unexplained and explained errors.
Measures the percentage of variation captured by the model. Adjusted R-Squared incorporated the number of variables used and
sample size to adjust the R-Squared value.
Copyright 2010 DeepThought, Inc. 16
-
8/9/2019 Forecast It 2. Linear Regression & Model Statistics
17/23
Linear Regression and Model Statistics
M2 Example R2
93.76%
Adjusted R2
93.76%
0.0
1000.0
2000.0
3000.0
4000.0
5000.0
6000.0
7000.0
8000.0
9000.0
May-79 Nov-84 May-90 Oct-95 Apr-01 Oct-06 Apr-12
M2 Money Stock (Billions of $'s)
Copyright 2010 DeepThought, Inc. 17
-
8/9/2019 Forecast It 2. Linear Regression & Model Statistics
18/23
Linear Regression and Model Statistics
Statistical SignificanceF-Test
A proportion between explained and unexplained errors of model. Used to test if model build is statistically significant from being
equal to zero.
The larger the F-test the better.
Copyright 2010 DeepThought, Inc. 18
-
8/9/2019 Forecast It 2. Linear Regression & Model Statistics
19/23
Linear Regression and Model Statistics
F-Test P-Value
The F-Test P-Valuerepresents the percentage of significance of the F-test. (Blue area on
graph)
The higher the value of the F-test the lower the shaded blue area is.
As the blue area decreases, confidence about our model being
statistically significant increases.
1 p-value = Significance Level of the Model (%)
Significance Level of the Model (%) represents the amount of
confidence we have that our model is different from a model with
no impact, or zero impact.Copyright 2010 DeepThought, Inc. 19
-
8/9/2019 Forecast It 2. Linear Regression & Model Statistics
20/23
Linear Regression and Model Statistics
M2 Example
0.0
1000.0
2000.0
3000.0
4000.0
5000.0
6000.0
7000.0
8000.0
9000.0
May-79 Nov-84 May-90 Oct-95 Apr-01 Oct-06 Apr-12
M2 Money Stock (Billions of $'s) F-Test
22778.98
F-Test P-Value
0.00
Copyright 2010 DeepThought, Inc. 20
-
8/9/2019 Forecast It 2. Linear Regression & Model Statistics
21/23
Linear Regression and Model Statistics
Compare Multiple Models Skip this step until have knowledge of multiple methods.
Will use Accuracy/Error statistics to compare multiple models to
find best models
Copyright 2010 DeepThought, Inc. 21
-
8/9/2019 Forecast It 2. Linear Regression & Model Statistics
22/23
Linear Regression and Model Statistics
Use Model Understand Limitations of Model.
Only measures a trend.
A long term average.
Answer Objectives.
Does M2 has a linear trend.
If trend exists, what is its magnitude.
If model statistically significant, forecast.
Copyright 2010 DeepThought, Inc. 22
-
8/9/2019 Forecast It 2. Linear Regression & Model Statistics
23/23
Linear Regression and Model Statistics
M2 Example M2 = 1145.31 + 4.04 * Time
Next Period is 1519
Forecast for that period is:
Y = 1145.31 + 4.04 * 1519
Y = 7283.446866
Copyright 2010 DeepThought, Inc. 23