SlideShare una empresa de Scribd logo
1 de 28
Descargar para leer sin conexión
The Suitcase Case
An introduction to linear regression
Anthony J. Evans
Professor of Economics, ESCP Europe
www.anthonyjevans.com
(cc) Anthony J. Evans 2019 | http://creativecommons.org/licenses/by-nc-sa/3.0/
Introduction
The world’s best luggage company are a pioneer of durable and
stylish travel. Their distinctive suitcases are a hand made luxury
product but following strong sales over the last few years the global
financial crisis has had a noticeable impact. Senior management are
interested in developing better analytical tools, to use data from
across their main locations and understand what’s driving their sales.
You need to answer the following questions:
1. The board suspect that the country manager for Poland is
underperforming. Based on the entire data set how many sales
would you expect a location with 14 stores to generate?
2. The board are interested in expanding into Brazil and are
targeting sales of 10,000 cases within the first year. They are
willing to invest in 8 stores – is this enough?
3. How strong are stores as a predictor of sales?
Download data set from: http://www.anthonyjevans.com/cases/ 2
Table 1
Y X
Observation Sales Stores
1 15,678 30
2 16,758 22
3 4,895 8
4 5,786 9
5 12,323 16
6 9,870 10
7 5,436 8
8 6,754 7
9 7,863 9
10 4,659 8
11 7,861 10
12 4,787 11
13 5,567 14
14 4,538 10
15 7,859 8
16 5,489 6
17 3,436 6
18 5,359 7
19 2,023 6
20 1,434 5
21 1,764 5
3
Graph 1
0
2,000
4,000
6,000
8,000
10,000
12,000
14,000
16,000
18,000
20,000
0 5 10 15 20 25 30 35
Sales
Stores
A simple scatter plot suggests that there is
a relationship between stores and sales.
Sites with more stores have higher sales
4
0
2,000
4,000
6,000
8,000
10,000
12,000
14,000
16,000
18,000
20,000
0 5 10 15 20 25 30 35
Sales
Stores
The standard linear equation
bxay +=
a = Intercept
The value of y when x=0
b = Slope/gradient
The amount by which y
changes when x increases by
one unit
Coefficients
a
b
y
x
5
Simple model
• Regression analysis is the study of the relationship between
one variable (the dependent variable, Y) and one or more
other variables (independent variables, X) with a view to
estimating and/or predicting the average value of the
dependent variable (Y) in terms of known (or fixed) values
of the independent ones (X)
– We accumulate independent variables (X) to explain a
dependent variable (Y)
• Fitting a line to data means drawing a line that comes as
close as possible to the points, providing a compact
description of how X explains Y
• In our case we are using changes in stores (X) to explain
changes in sales (Y)
6
Ordinary Least Squares: Introduction
• Ordinary Least Squares (OLS) is a systematic method to
construct the regression line
• Since we wish to predict Y from X, we want a line that is as
close as possible to the points in the vertical direction
• We fit a line based on our past observations, in the
expectation that they will help us predict future events
• We have observations that give the real value of Y, and
our regression line makes a prediction of Y (Y*).
• We want to minimise the residual:
Residual = observed value – predicted value
7An alternative method is to find an average no. of sales per store and multiply by 14. Since OLS will
exaggerate the deviations it is a different method and therefore provides different results.
0
2,000
4,000
6,000
8,000
10,000
12,000
14,000
16,000
18,000
20,000
0 5 10 15 20 25 30 35
Sales
Stores
Graph 2
y
e1
Y* (fitted value)
Y (actual value)
x
e2
8
e3
Ordinary Least Squares: Process
• Take each observation (• ) and measure the deviation
between the actual value (Y) and the fitted value (Y*) =
(e1, e2, e3)
• Every observation has a corresponding e
– e2: squaring e will get rid of negative values, and give
more weight to larger deviations
– å e2: summing e2 takes into account all deviations
– minå e2: make the fitted model as tight as possible to
the sampled data by finding the minimum of the
summed and squared values
• Ordinary least squares (OLS) is a method of finding a* and
b* such that the sum of squared residuals (å e2) is
minimised
9
min $ 𝑒&
y = 584.83x + 685.74
R² = 0.7455
0
2,000
4,000
6,000
8,000
10,000
12,000
14,000
16,000
18,000
20,000
0 5 10 15 20 25 30 35
Sales
Stores
Graph 3
Commands
• Chart > Add Trendline…
• Format Trendline > Options
– Display equation on chart
– Display R-squared value on
chart
10
Using Microsoft Excel (2003) for regression analysis
Commands
a) Tools > Add ins… > Analysis ToolPak
b) Tools > Data analysis > Regression
11
Using Microsoft Excel (2007) for regression analysis
Commands
a) Office button > Excel options
– Add ins > Manage > Excel add ins > Go
– Analysis ToolPak > OK
b) Data > Analysis > Data analysis
12
Using Microsoft Excel Mac (2016) for regression analysis
Commands
a) Tools > Excel Add ins… > Analysis ToolPak
b) Data > Data analysis > Regression
13
Output
14
𝑦 = 𝑎 + 𝑏𝑥
s𝑎𝑙𝑒𝑠 = 𝑎 + 𝑏(𝑠𝑡𝑜𝑟𝑒𝑠)
s𝑎𝑙𝑒𝑠 = 685.74 + 584.83(𝑠𝑡𝑜𝑟𝑒𝑠)
ANOVA stands for “Analysis of Variance” which tests whether the means of different groups are equal.
We do not need to use it for our purposes.
1. The board suspect that the country manager for Poland is
underperforming. Based on the entire data set how many sales would
you expect a location with 14 stores to generate?
15
𝑦 = 685.74 + 584.83𝑥
𝑦 = 685.74 + 584.83(14)
𝑦 = 8,873
2. The board are interested in expanding into Brazil and are targeting
sales of 10,000 cases within the first year. They are willing to invest
in 8 stores – is this enough?
16
𝑦 = 685.74 + 584.83𝑥
10,000 = 685.74 + 584.83𝑥
10,000 − 685.74
584.83
= 𝑥
∴ 𝑥 = 16
Table 2 – a recap on how we generated a and b
17
Table 2
Y X Ŷ Ŷ-Y (Ŷ-Y)^2
Sales Stores Fitted Residual MSE
15,678 30 18,231 -2,552.64 6,515,971
16,758 22 13,552 3,206.00 10,278,436
4,895 8 5,364 -469.38 220,318
5,786 9 5,949 -163.21 26,638
12,323 16 10,043 2,279.98 5,198,309
9,870 10 6,534 3,335.96 11,128,629
5,436 8 5,364 71.62 5,129
6,754 7 4,780 1,974.45 3,898,453
7,863 9 5,949 1,913.79 3,662,592
4,659 8 5,364 -705.38 497,561
7,861 10 6,534 1,326.96 1,760,823
4,787 11 7,119 -2,331.87 5,437,618
5,567 14 8,873 -3,306.36 10,932,016
4,538 10 6,534 -1,996.04 3,984,176
7,859 8 5,364 2,494.62 6,223,129
5,489 6 4,195 1,294.28 1,675,161
3,436 6 4,195 -758.72 575,656
5,359 7 4,780 579.45 335,762
2,023 6 4,195 -2,171.72 4,716,368
1,434 5 3,610 -2,175.89 4,734,497
1,764 5 3,610 -1,845.89 3,407,310
Residual mean Mean Squared Error
Y=685.74+584.83X 0.00 4,057,836
Multiple R
• r is a measure of the index of co-relation between two
variables
• Correlation
– A number between -1 and +1 that indicates if two
variables are linearly related
– If r = 1 there is a perfectly positive relationship
– If r = -1 there is a perfectly negative relationship
– If r = 0 there is no (linear) relationship
• If we only have a single independent variable R-squared
will be equal to the square of the correlation between the
dependent and independent variable.
– In our case Multiple R = 0.863 and R-squared = 0.745
• We can also find r doing correlation analysis
18
R-squared
• r2 is the most commonly used goodness of fit for a
regression line
• It measures the proportion or percentage of the total
variation in Y explained by the regression model
• Hence 0 < r2 < 1 and the higher r2 the better
– If r2 = 0 then there is no relationship between X and Y
– If r2 = 1 then △X = △Y
19If we are comparing ice cream sales and wearing shorts we can imagine that r is high (more X = more Y)
but r2 is low (△X /= △Y). Remember that correlation doesn’t mean causation!
Adjusted R-squared
• Adjusted r2 is a more precise measure of r2 since it takes
into account the number of independent variables in the
model
• It only increases if a new variable improves the model
20
𝑟&
= 1 −
𝑆𝐸&
𝑠&
Note: here we’re using the SE of the error terms and the s of the dependent variable (Y)
Standard error
• The standard error is 2,117 – this is our estimate of the
standard deviation of the residual error terms (i.e. how
close the points are to the regression line)
• If these errors are normally distributed
– 68% of errors are within ± SE of the line
– 95% of errors are within ± 2SE of the line
– 99.7% of errors are within ± 3SE of the line
• The lower the SE the better the fit
• The SE gives an absolute measure of fit, r2 is a relative
measure
• r2 tells us how well the model does compared to our next
best alternative – the values of Y
21Note: the standard error is the same unit of measurement as the dependent variable (Y).
Notice that the standard error is ≈ the square root of the mean squared error.
Table 3 – calculation for adjusted r2
Y X Ŷ
Sales Stores Fitted
15,678 30 18,231
16,758 22 13,552
4,895 8 5,364
5,786 9 5,949
12,323 16 10,043
9,870 10 6,534
5,436 8 5,364
6,754 7 4,780
7,863 9 5,949
4,659 8 5,364
7,861 10 6,534
4,787 11 7,119
5,567 14 8,873
4,538 10 6,534
7,859 8 5,364
5,489 6 4,195
3,436 6 4,195
5,359 7 4,780
2,023 6 4,195
1,434 5 3,610
1,764 5 3,610
Mean 6,673.29
StDev 4,091.63
22
𝑟&
= 1 −
𝑆𝐸&
𝑠&
𝑟&
= 1 −
2117&
4091&
𝑟&
= 1 −
4,481,689
16,736,281
𝑟&
= 1 − 0.268
𝑟&
= 0.732
3. How strong are stores as a predictor of sales?
Adjusted r2 = 0.732
According to our model 73.2% of sales are determined by the
number of stores
26.8% of sales are determined by other factors, which can be
factored into our model to create a more robust picture
23
Summary
24
Solutions
1. The board suspect that the country manager for Poland is
underperforming. Based on the entire data set how many sales
would you expect a location with 14 stores to generate?
– 8,873 cases (compared to 5,567)
2. The board are interested in expanding into Brazil and are
targeting sales of 10,000 cases within the first few years. They
are willing to invest in 8 stores – is this enough?
– No! They need around 16 stores
3. How strong are stores as a predictor of sales?
– They explain over 70%
25
Discussion questions
• Issues of outliers – should we remove Germany?
• Omitted variables
– Marketing budget
• Dangers of extrapolation – can we make estimates outside
the range in which the data was constructed?
• How can we improve on the model?
– GDP per capita
– No. of business trips per year
26
Summary (2)
27
Appendix
The Excel output also gives the standard errors of the coefficients (given
in brackets)
t Stat
• The estimated coefficient divided by the standard error
• The distance between b and 0 (measured in units of the standard
errors
• It’s how many standard errors the estimate is from 0
P value
• The probability of seeing a t stat that big (or bigger) if β = 0
• There is a 0.00000046 chance of a t stat bigger than 7.46
The t stat is large (and the p value small) so we are confident that β >
0, i.e. that the number of stores have a positive effect on sales
We may wish to perform a test against a more reasonable hypothesis
(e.g. β = 500)
Note: we use a t-stat instead of a z score because of the low sample size, but the intuition is identical 28
(926) (78.39)
𝑦 = 685.74 + 584.83𝑥

Más contenido relacionado

La actualidad más candente

Stat lesson 5.1 probability distributions
Stat lesson 5.1 probability distributionsStat lesson 5.1 probability distributions
Stat lesson 5.1 probability distributionspipamutuc
 
Probability, Discrete Probability, Normal Probabilty
Probability, Discrete Probability, Normal ProbabiltyProbability, Discrete Probability, Normal Probabilty
Probability, Discrete Probability, Normal ProbabiltyFaisal Hussain
 
Discrete and continuous probability distributions ppt @ bec doms
Discrete and continuous probability distributions ppt @ bec domsDiscrete and continuous probability distributions ppt @ bec doms
Discrete and continuous probability distributions ppt @ bec domsBabasab Patil
 
Chapter2 slides-part 2-harish complete
Chapter2 slides-part 2-harish completeChapter2 slides-part 2-harish complete
Chapter2 slides-part 2-harish completeEasyStudy3
 
Chapter 7 Powerpoint
Chapter 7 PowerpointChapter 7 Powerpoint
Chapter 7 PowerpointZIADALRIFAI
 
Normal Distribution, Binomial Distribution, Poisson Distribution
Normal Distribution, Binomial Distribution, Poisson DistributionNormal Distribution, Binomial Distribution, Poisson Distribution
Normal Distribution, Binomial Distribution, Poisson DistributionQ Dauh Q Alam
 
Normal distribution - Unitedworld School of Business
Normal distribution - Unitedworld School of BusinessNormal distribution - Unitedworld School of Business
Normal distribution - Unitedworld School of BusinessArnab Roy Chowdhury
 
Probability Distributions for Continuous Variables
Probability Distributions for Continuous VariablesProbability Distributions for Continuous Variables
Probability Distributions for Continuous Variablesgetyourcheaton
 
Chapter 06
Chapter 06Chapter 06
Chapter 06bmcfad01
 
Probability distribution
Probability distributionProbability distribution
Probability distributionPunit Raut
 
Probability distribution
Probability distributionProbability distribution
Probability distributionRohit kumar
 
Psych stats Probability and Probability Distribution
Psych stats Probability and Probability DistributionPsych stats Probability and Probability Distribution
Psych stats Probability and Probability DistributionMartin Vince Cruz, RPm
 
Probability Distribution
Probability DistributionProbability Distribution
Probability DistributionSarabjeet Kaur
 
Probability distributions
Probability distributionsProbability distributions
Probability distributionsmvskrishna
 
Binomial and Poission Probablity distribution
Binomial and Poission Probablity distributionBinomial and Poission Probablity distribution
Binomial and Poission Probablity distributionPrateek Singla
 
Different types of distributions
Different types of distributionsDifferent types of distributions
Different types of distributionsRajaKrishnan M
 

La actualidad más candente (20)

Discrete Probability Distributions.
Discrete Probability Distributions.Discrete Probability Distributions.
Discrete Probability Distributions.
 
Stat lesson 5.1 probability distributions
Stat lesson 5.1 probability distributionsStat lesson 5.1 probability distributions
Stat lesson 5.1 probability distributions
 
Probability, Discrete Probability, Normal Probabilty
Probability, Discrete Probability, Normal ProbabiltyProbability, Discrete Probability, Normal Probabilty
Probability, Discrete Probability, Normal Probabilty
 
Discrete and continuous probability distributions ppt @ bec doms
Discrete and continuous probability distributions ppt @ bec domsDiscrete and continuous probability distributions ppt @ bec doms
Discrete and continuous probability distributions ppt @ bec doms
 
Chapter2 slides-part 2-harish complete
Chapter2 slides-part 2-harish completeChapter2 slides-part 2-harish complete
Chapter2 slides-part 2-harish complete
 
Chapter 3
Chapter 3Chapter 3
Chapter 3
 
Chapter 7 Powerpoint
Chapter 7 PowerpointChapter 7 Powerpoint
Chapter 7 Powerpoint
 
Normal Distribution, Binomial Distribution, Poisson Distribution
Normal Distribution, Binomial Distribution, Poisson DistributionNormal Distribution, Binomial Distribution, Poisson Distribution
Normal Distribution, Binomial Distribution, Poisson Distribution
 
Normal distribution - Unitedworld School of Business
Normal distribution - Unitedworld School of BusinessNormal distribution - Unitedworld School of Business
Normal distribution - Unitedworld School of Business
 
Chapter 05
Chapter 05 Chapter 05
Chapter 05
 
Probability Distributions for Continuous Variables
Probability Distributions for Continuous VariablesProbability Distributions for Continuous Variables
Probability Distributions for Continuous Variables
 
Chapter 06
Chapter 06Chapter 06
Chapter 06
 
Probability distribution
Probability distributionProbability distribution
Probability distribution
 
Probability distribution
Probability distributionProbability distribution
Probability distribution
 
Psych stats Probability and Probability Distribution
Psych stats Probability and Probability DistributionPsych stats Probability and Probability Distribution
Psych stats Probability and Probability Distribution
 
Probability Distribution
Probability DistributionProbability Distribution
Probability Distribution
 
Probability distributions
Probability distributionsProbability distributions
Probability distributions
 
Les5e ppt 04
Les5e ppt 04Les5e ppt 04
Les5e ppt 04
 
Binomial and Poission Probablity distribution
Binomial and Poission Probablity distributionBinomial and Poission Probablity distribution
Binomial and Poission Probablity distribution
 
Different types of distributions
Different types of distributionsDifferent types of distributions
Different types of distributions
 

Similar a The Suitcase Case

Linear Regression Analysis | Linear Regression in Python | Machine Learning A...
Linear Regression Analysis | Linear Regression in Python | Machine Learning A...Linear Regression Analysis | Linear Regression in Python | Machine Learning A...
Linear Regression Analysis | Linear Regression in Python | Machine Learning A...Simplilearn
 
Simple Regression Years with Midwest and Shelf Space Winter .docx
Simple Regression Years with Midwest and Shelf Space Winter .docxSimple Regression Years with Midwest and Shelf Space Winter .docx
Simple Regression Years with Midwest and Shelf Space Winter .docxbudabrooks46239
 
Multiple Regression.ppt
Multiple Regression.pptMultiple Regression.ppt
Multiple Regression.pptTanyaWadhwani4
 
Lesson07_new
Lesson07_newLesson07_new
Lesson07_newshengvn
 
Data Analysison Regression
Data Analysison RegressionData Analysison Regression
Data Analysison Regressionjamuga gitulho
 
Eco550 Assignment 1
Eco550 Assignment 1Eco550 Assignment 1
Eco550 Assignment 1Lisa Kennedy
 
4. regression analysis1
4. regression analysis14. regression analysis1
4. regression analysis1Karan Kukreja
 
Lecture - 8 MLR.pptx
Lecture - 8 MLR.pptxLecture - 8 MLR.pptx
Lecture - 8 MLR.pptxiris765749
 
Regression analysis
Regression analysisRegression analysis
Regression analysisSrikant001p
 
Regression analysis in excel
Regression analysis in excelRegression analysis in excel
Regression analysis in excelAwais Salman
 
Bba 3274 qm week 6 part 1 regression models
Bba 3274 qm week 6 part 1 regression modelsBba 3274 qm week 6 part 1 regression models
Bba 3274 qm week 6 part 1 regression modelsStephen Ong
 

Similar a The Suitcase Case (20)

01_SLR_final (1).pptx
01_SLR_final (1).pptx01_SLR_final (1).pptx
01_SLR_final (1).pptx
 
Linear Regression Analysis | Linear Regression in Python | Machine Learning A...
Linear Regression Analysis | Linear Regression in Python | Machine Learning A...Linear Regression Analysis | Linear Regression in Python | Machine Learning A...
Linear Regression Analysis | Linear Regression in Python | Machine Learning A...
 
Simple Regression Years with Midwest and Shelf Space Winter .docx
Simple Regression Years with Midwest and Shelf Space Winter .docxSimple Regression Years with Midwest and Shelf Space Winter .docx
Simple Regression Years with Midwest and Shelf Space Winter .docx
 
Demand Forcasting
Demand ForcastingDemand Forcasting
Demand Forcasting
 
Multiple Regression.ppt
Multiple Regression.pptMultiple Regression.ppt
Multiple Regression.ppt
 
Lesson07_new
Lesson07_newLesson07_new
Lesson07_new
 
Regression
RegressionRegression
Regression
 
Rsh qam11 ch04 ge
Rsh qam11 ch04 geRsh qam11 ch04 ge
Rsh qam11 ch04 ge
 
Regression
Regression  Regression
Regression
 
Data Analysison Regression
Data Analysison RegressionData Analysison Regression
Data Analysison Regression
 
Eco550 Assignment 1
Eco550 Assignment 1Eco550 Assignment 1
Eco550 Assignment 1
 
4. regression analysis1
4. regression analysis14. regression analysis1
4. regression analysis1
 
Lecture - 8 MLR.pptx
Lecture - 8 MLR.pptxLecture - 8 MLR.pptx
Lecture - 8 MLR.pptx
 
Statistics homework help
Statistics homework helpStatistics homework help
Statistics homework help
 
Regression analysis
Regression analysisRegression analysis
Regression analysis
 
Time series
Time seriesTime series
Time series
 
Regression analysis in excel
Regression analysis in excelRegression analysis in excel
Regression analysis in excel
 
Control charts
Control chartsControl charts
Control charts
 
Corrleation and regression
Corrleation and regressionCorrleation and regression
Corrleation and regression
 
Bba 3274 qm week 6 part 1 regression models
Bba 3274 qm week 6 part 1 regression modelsBba 3274 qm week 6 part 1 regression models
Bba 3274 qm week 6 part 1 regression models
 

Más de Anthony J. Evans (13)

Time Series
Time SeriesTime Series
Time Series
 
Correlation
Correlation Correlation
Correlation
 
Nonparametric Statistics
Nonparametric StatisticsNonparametric Statistics
Nonparametric Statistics
 
Student's T Test
Student's T TestStudent's T Test
Student's T Test
 
Inferential Statistics
Inferential StatisticsInferential Statistics
Inferential Statistics
 
Probability Theory
Probability Theory Probability Theory
Probability Theory
 
Descriptive Statistics
Descriptive StatisticsDescriptive Statistics
Descriptive Statistics
 
Statistical Literacy
Statistical Literacy Statistical Literacy
Statistical Literacy
 
Quantitative Methods
Quantitative Methods Quantitative Methods
Quantitative Methods
 
Collecting and Presenting Data
Collecting and Presenting DataCollecting and Presenting Data
Collecting and Presenting Data
 
Numeracy Skills 1
Numeracy Skills 1Numeracy Skills 1
Numeracy Skills 1
 
The Dynamic AD AS Model
The Dynamic AD AS ModelThe Dynamic AD AS Model
The Dynamic AD AS Model
 
Numeracy Skills 2
Numeracy Skills 2Numeracy Skills 2
Numeracy Skills 2
 

Último

High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...soniya singh
 
专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改
专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改
专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改yuu sss
 
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)jennyeacort
 
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdfKantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdfSocial Samosa
 
Easter Eggs From Star Wars and in cars 1 and 2
Easter Eggs From Star Wars and in cars 1 and 2Easter Eggs From Star Wars and in cars 1 and 2
Easter Eggs From Star Wars and in cars 1 and 217djon017
 
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样vhwb25kk
 
Customer Service Analytics - Make Sense of All Your Data.pptx
Customer Service Analytics - Make Sense of All Your Data.pptxCustomer Service Analytics - Make Sense of All Your Data.pptx
Customer Service Analytics - Make Sense of All Your Data.pptxEmmanuel Dauda
 
Heart Disease Classification Report: A Data Analysis Project
Heart Disease Classification Report: A Data Analysis ProjectHeart Disease Classification Report: A Data Analysis Project
Heart Disease Classification Report: A Data Analysis ProjectBoston Institute of Analytics
 
Generative AI for Social Good at Open Data Science East 2024
Generative AI for Social Good at Open Data Science East 2024Generative AI for Social Good at Open Data Science East 2024
Generative AI for Social Good at Open Data Science East 2024Colleen Farrelly
 
Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...
Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...
Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...limedy534
 
GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]📊 Markus Baersch
 
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一F sss
 
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024thyngster
 
RS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝Delhi
RS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝DelhiRS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝Delhi
RS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝Delhijennyeacort
 
Top 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In QueensTop 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In Queensdataanalyticsqueen03
 
How we prevented account sharing with MFA
How we prevented account sharing with MFAHow we prevented account sharing with MFA
How we prevented account sharing with MFAAndrei Kaleshka
 
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...dajasot375
 
Defining Constituents, Data Vizzes and Telling a Data Story
Defining Constituents, Data Vizzes and Telling a Data StoryDefining Constituents, Data Vizzes and Telling a Data Story
Defining Constituents, Data Vizzes and Telling a Data StoryJeremy Anderson
 
MK KOMUNIKASI DATA (TI)komdat komdat.docx
MK KOMUNIKASI DATA (TI)komdat komdat.docxMK KOMUNIKASI DATA (TI)komdat komdat.docx
MK KOMUNIKASI DATA (TI)komdat komdat.docxUnduhUnggah1
 
PKS-TGC-1084-630 - Stage 1 Proposal.pptx
PKS-TGC-1084-630 - Stage 1 Proposal.pptxPKS-TGC-1084-630 - Stage 1 Proposal.pptx
PKS-TGC-1084-630 - Stage 1 Proposal.pptxPramod Kumar Srivastava
 

Último (20)

High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
 
专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改
专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改
专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改
 
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
 
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdfKantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
 
Easter Eggs From Star Wars and in cars 1 and 2
Easter Eggs From Star Wars and in cars 1 and 2Easter Eggs From Star Wars and in cars 1 and 2
Easter Eggs From Star Wars and in cars 1 and 2
 
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
 
Customer Service Analytics - Make Sense of All Your Data.pptx
Customer Service Analytics - Make Sense of All Your Data.pptxCustomer Service Analytics - Make Sense of All Your Data.pptx
Customer Service Analytics - Make Sense of All Your Data.pptx
 
Heart Disease Classification Report: A Data Analysis Project
Heart Disease Classification Report: A Data Analysis ProjectHeart Disease Classification Report: A Data Analysis Project
Heart Disease Classification Report: A Data Analysis Project
 
Generative AI for Social Good at Open Data Science East 2024
Generative AI for Social Good at Open Data Science East 2024Generative AI for Social Good at Open Data Science East 2024
Generative AI for Social Good at Open Data Science East 2024
 
Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...
Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...
Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...
 
GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]
 
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一
 
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
 
RS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝Delhi
RS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝DelhiRS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝Delhi
RS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝Delhi
 
Top 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In QueensTop 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In Queens
 
How we prevented account sharing with MFA
How we prevented account sharing with MFAHow we prevented account sharing with MFA
How we prevented account sharing with MFA
 
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
 
Defining Constituents, Data Vizzes and Telling a Data Story
Defining Constituents, Data Vizzes and Telling a Data StoryDefining Constituents, Data Vizzes and Telling a Data Story
Defining Constituents, Data Vizzes and Telling a Data Story
 
MK KOMUNIKASI DATA (TI)komdat komdat.docx
MK KOMUNIKASI DATA (TI)komdat komdat.docxMK KOMUNIKASI DATA (TI)komdat komdat.docx
MK KOMUNIKASI DATA (TI)komdat komdat.docx
 
PKS-TGC-1084-630 - Stage 1 Proposal.pptx
PKS-TGC-1084-630 - Stage 1 Proposal.pptxPKS-TGC-1084-630 - Stage 1 Proposal.pptx
PKS-TGC-1084-630 - Stage 1 Proposal.pptx
 

The Suitcase Case

  • 1. The Suitcase Case An introduction to linear regression Anthony J. Evans Professor of Economics, ESCP Europe www.anthonyjevans.com (cc) Anthony J. Evans 2019 | http://creativecommons.org/licenses/by-nc-sa/3.0/
  • 2. Introduction The world’s best luggage company are a pioneer of durable and stylish travel. Their distinctive suitcases are a hand made luxury product but following strong sales over the last few years the global financial crisis has had a noticeable impact. Senior management are interested in developing better analytical tools, to use data from across their main locations and understand what’s driving their sales. You need to answer the following questions: 1. The board suspect that the country manager for Poland is underperforming. Based on the entire data set how many sales would you expect a location with 14 stores to generate? 2. The board are interested in expanding into Brazil and are targeting sales of 10,000 cases within the first year. They are willing to invest in 8 stores – is this enough? 3. How strong are stores as a predictor of sales? Download data set from: http://www.anthonyjevans.com/cases/ 2
  • 3. Table 1 Y X Observation Sales Stores 1 15,678 30 2 16,758 22 3 4,895 8 4 5,786 9 5 12,323 16 6 9,870 10 7 5,436 8 8 6,754 7 9 7,863 9 10 4,659 8 11 7,861 10 12 4,787 11 13 5,567 14 14 4,538 10 15 7,859 8 16 5,489 6 17 3,436 6 18 5,359 7 19 2,023 6 20 1,434 5 21 1,764 5 3
  • 4. Graph 1 0 2,000 4,000 6,000 8,000 10,000 12,000 14,000 16,000 18,000 20,000 0 5 10 15 20 25 30 35 Sales Stores A simple scatter plot suggests that there is a relationship between stores and sales. Sites with more stores have higher sales 4
  • 5. 0 2,000 4,000 6,000 8,000 10,000 12,000 14,000 16,000 18,000 20,000 0 5 10 15 20 25 30 35 Sales Stores The standard linear equation bxay += a = Intercept The value of y when x=0 b = Slope/gradient The amount by which y changes when x increases by one unit Coefficients a b y x 5
  • 6. Simple model • Regression analysis is the study of the relationship between one variable (the dependent variable, Y) and one or more other variables (independent variables, X) with a view to estimating and/or predicting the average value of the dependent variable (Y) in terms of known (or fixed) values of the independent ones (X) – We accumulate independent variables (X) to explain a dependent variable (Y) • Fitting a line to data means drawing a line that comes as close as possible to the points, providing a compact description of how X explains Y • In our case we are using changes in stores (X) to explain changes in sales (Y) 6
  • 7. Ordinary Least Squares: Introduction • Ordinary Least Squares (OLS) is a systematic method to construct the regression line • Since we wish to predict Y from X, we want a line that is as close as possible to the points in the vertical direction • We fit a line based on our past observations, in the expectation that they will help us predict future events • We have observations that give the real value of Y, and our regression line makes a prediction of Y (Y*). • We want to minimise the residual: Residual = observed value – predicted value 7An alternative method is to find an average no. of sales per store and multiply by 14. Since OLS will exaggerate the deviations it is a different method and therefore provides different results.
  • 8. 0 2,000 4,000 6,000 8,000 10,000 12,000 14,000 16,000 18,000 20,000 0 5 10 15 20 25 30 35 Sales Stores Graph 2 y e1 Y* (fitted value) Y (actual value) x e2 8 e3
  • 9. Ordinary Least Squares: Process • Take each observation (• ) and measure the deviation between the actual value (Y) and the fitted value (Y*) = (e1, e2, e3) • Every observation has a corresponding e – e2: squaring e will get rid of negative values, and give more weight to larger deviations – å e2: summing e2 takes into account all deviations – minå e2: make the fitted model as tight as possible to the sampled data by finding the minimum of the summed and squared values • Ordinary least squares (OLS) is a method of finding a* and b* such that the sum of squared residuals (å e2) is minimised 9 min $ 𝑒&
  • 10. y = 584.83x + 685.74 R² = 0.7455 0 2,000 4,000 6,000 8,000 10,000 12,000 14,000 16,000 18,000 20,000 0 5 10 15 20 25 30 35 Sales Stores Graph 3 Commands • Chart > Add Trendline… • Format Trendline > Options – Display equation on chart – Display R-squared value on chart 10
  • 11. Using Microsoft Excel (2003) for regression analysis Commands a) Tools > Add ins… > Analysis ToolPak b) Tools > Data analysis > Regression 11
  • 12. Using Microsoft Excel (2007) for regression analysis Commands a) Office button > Excel options – Add ins > Manage > Excel add ins > Go – Analysis ToolPak > OK b) Data > Analysis > Data analysis 12
  • 13. Using Microsoft Excel Mac (2016) for regression analysis Commands a) Tools > Excel Add ins… > Analysis ToolPak b) Data > Data analysis > Regression 13
  • 14. Output 14 𝑦 = 𝑎 + 𝑏𝑥 s𝑎𝑙𝑒𝑠 = 𝑎 + 𝑏(𝑠𝑡𝑜𝑟𝑒𝑠) s𝑎𝑙𝑒𝑠 = 685.74 + 584.83(𝑠𝑡𝑜𝑟𝑒𝑠) ANOVA stands for “Analysis of Variance” which tests whether the means of different groups are equal. We do not need to use it for our purposes.
  • 15. 1. The board suspect that the country manager for Poland is underperforming. Based on the entire data set how many sales would you expect a location with 14 stores to generate? 15 𝑦 = 685.74 + 584.83𝑥 𝑦 = 685.74 + 584.83(14) 𝑦 = 8,873
  • 16. 2. The board are interested in expanding into Brazil and are targeting sales of 10,000 cases within the first year. They are willing to invest in 8 stores – is this enough? 16 𝑦 = 685.74 + 584.83𝑥 10,000 = 685.74 + 584.83𝑥 10,000 − 685.74 584.83 = 𝑥 ∴ 𝑥 = 16
  • 17. Table 2 – a recap on how we generated a and b 17 Table 2 Y X Ŷ Ŷ-Y (Ŷ-Y)^2 Sales Stores Fitted Residual MSE 15,678 30 18,231 -2,552.64 6,515,971 16,758 22 13,552 3,206.00 10,278,436 4,895 8 5,364 -469.38 220,318 5,786 9 5,949 -163.21 26,638 12,323 16 10,043 2,279.98 5,198,309 9,870 10 6,534 3,335.96 11,128,629 5,436 8 5,364 71.62 5,129 6,754 7 4,780 1,974.45 3,898,453 7,863 9 5,949 1,913.79 3,662,592 4,659 8 5,364 -705.38 497,561 7,861 10 6,534 1,326.96 1,760,823 4,787 11 7,119 -2,331.87 5,437,618 5,567 14 8,873 -3,306.36 10,932,016 4,538 10 6,534 -1,996.04 3,984,176 7,859 8 5,364 2,494.62 6,223,129 5,489 6 4,195 1,294.28 1,675,161 3,436 6 4,195 -758.72 575,656 5,359 7 4,780 579.45 335,762 2,023 6 4,195 -2,171.72 4,716,368 1,434 5 3,610 -2,175.89 4,734,497 1,764 5 3,610 -1,845.89 3,407,310 Residual mean Mean Squared Error Y=685.74+584.83X 0.00 4,057,836
  • 18. Multiple R • r is a measure of the index of co-relation between two variables • Correlation – A number between -1 and +1 that indicates if two variables are linearly related – If r = 1 there is a perfectly positive relationship – If r = -1 there is a perfectly negative relationship – If r = 0 there is no (linear) relationship • If we only have a single independent variable R-squared will be equal to the square of the correlation between the dependent and independent variable. – In our case Multiple R = 0.863 and R-squared = 0.745 • We can also find r doing correlation analysis 18
  • 19. R-squared • r2 is the most commonly used goodness of fit for a regression line • It measures the proportion or percentage of the total variation in Y explained by the regression model • Hence 0 < r2 < 1 and the higher r2 the better – If r2 = 0 then there is no relationship between X and Y – If r2 = 1 then △X = △Y 19If we are comparing ice cream sales and wearing shorts we can imagine that r is high (more X = more Y) but r2 is low (△X /= △Y). Remember that correlation doesn’t mean causation!
  • 20. Adjusted R-squared • Adjusted r2 is a more precise measure of r2 since it takes into account the number of independent variables in the model • It only increases if a new variable improves the model 20 𝑟& = 1 − 𝑆𝐸& 𝑠& Note: here we’re using the SE of the error terms and the s of the dependent variable (Y)
  • 21. Standard error • The standard error is 2,117 – this is our estimate of the standard deviation of the residual error terms (i.e. how close the points are to the regression line) • If these errors are normally distributed – 68% of errors are within ± SE of the line – 95% of errors are within ± 2SE of the line – 99.7% of errors are within ± 3SE of the line • The lower the SE the better the fit • The SE gives an absolute measure of fit, r2 is a relative measure • r2 tells us how well the model does compared to our next best alternative – the values of Y 21Note: the standard error is the same unit of measurement as the dependent variable (Y). Notice that the standard error is ≈ the square root of the mean squared error.
  • 22. Table 3 – calculation for adjusted r2 Y X Ŷ Sales Stores Fitted 15,678 30 18,231 16,758 22 13,552 4,895 8 5,364 5,786 9 5,949 12,323 16 10,043 9,870 10 6,534 5,436 8 5,364 6,754 7 4,780 7,863 9 5,949 4,659 8 5,364 7,861 10 6,534 4,787 11 7,119 5,567 14 8,873 4,538 10 6,534 7,859 8 5,364 5,489 6 4,195 3,436 6 4,195 5,359 7 4,780 2,023 6 4,195 1,434 5 3,610 1,764 5 3,610 Mean 6,673.29 StDev 4,091.63 22 𝑟& = 1 − 𝑆𝐸& 𝑠& 𝑟& = 1 − 2117& 4091& 𝑟& = 1 − 4,481,689 16,736,281 𝑟& = 1 − 0.268 𝑟& = 0.732
  • 23. 3. How strong are stores as a predictor of sales? Adjusted r2 = 0.732 According to our model 73.2% of sales are determined by the number of stores 26.8% of sales are determined by other factors, which can be factored into our model to create a more robust picture 23
  • 25. Solutions 1. The board suspect that the country manager for Poland is underperforming. Based on the entire data set how many sales would you expect a location with 14 stores to generate? – 8,873 cases (compared to 5,567) 2. The board are interested in expanding into Brazil and are targeting sales of 10,000 cases within the first few years. They are willing to invest in 8 stores – is this enough? – No! They need around 16 stores 3. How strong are stores as a predictor of sales? – They explain over 70% 25
  • 26. Discussion questions • Issues of outliers – should we remove Germany? • Omitted variables – Marketing budget • Dangers of extrapolation – can we make estimates outside the range in which the data was constructed? • How can we improve on the model? – GDP per capita – No. of business trips per year 26
  • 28. Appendix The Excel output also gives the standard errors of the coefficients (given in brackets) t Stat • The estimated coefficient divided by the standard error • The distance between b and 0 (measured in units of the standard errors • It’s how many standard errors the estimate is from 0 P value • The probability of seeing a t stat that big (or bigger) if β = 0 • There is a 0.00000046 chance of a t stat bigger than 7.46 The t stat is large (and the p value small) so we are confident that β > 0, i.e. that the number of stores have a positive effect on sales We may wish to perform a test against a more reasonable hypothesis (e.g. β = 500) Note: we use a t-stat instead of a z score because of the low sample size, but the intuition is identical 28 (926) (78.39) 𝑦 = 685.74 + 584.83𝑥