Quantitative Methods: Pilani
Quantitative Methods: Pilani
Lecture-1
BITS Pilani
Pilani Campus
1
Important class rules
1. Business Statistics
▪ Business Statistics: A First Course by D.M. Levine,
T.C. Krehbiel, M.L. Berenson and P. K. Viswanathan.
Seventh edition.
Pearson Education.
Available at Amazon
2. Management Science/Optimisation
▪ Quantitative Methods for Business. David R
Anderson, Dennis J Sweeney, Thomas A Williams,
Jeffrey D Camm and Kipp Martin. Twelfth edition.
Cengage Learning. 2013.
Available at Amazon
3
BITS Pilani, Pilani Campus
Course coverage
1. Business Statistics
▪ Data collection, presentation, basic probability,
estimation, hypothesis testing, correlation, and
regression.
2. Management Science
▪ Optimisation techniques- Linear programming,
transportation problems, and assignment
problems.
3. Practice
▪ Solve problems in MS Excel/ any other software.
4
BITS Pilani, Pilani Campus
Syllabus - Refer to the course handout
Textbook # Chapter # Chapter Title
1 1 Defining and Collecting Data
6
BITS Pilani, Pilani Campus
Why Quantitative Methods?
• Start using data and quantitative analysis for your business decisions
Is there a relationship between the customer’s gender and the color preference of the car?
How do I create a portfolio for maximizing the return to risk ratio with limited budget?
How to split marketing budget for maximum returns: acquisition vs. retention?
8
BITS Pilani, Pilani Campus
QM can be applied to intangible
constructs also
Anything that cannot be measured cannot be improved.
– Brand Recall
– Customer experience
– Employee Performance
– Investor Perceptions
9
BITS Pilani, Pilani Campus
BITS Pilani
Pilani Campus
11
BITS Pilani, Pilani Campus
Data and Variables
• Start with your business objective
• Define data that you want to collect to achieve that
• Example: Employee performance review
• What kind of data will help you achieve this objective?
• Collect data
• How do you collect this data?
• Organize and visualize
• What is the distribution of employee performance in your
department?
• Analyze to answer business questions
• Top 5% get 20% raise etc. 12
BITS Pilani, Pilani Campus
Data and Variables
• Variables
• Features, characteristics or columns of a record
• What are the variables in the sales record table shown
below?
• Type in the chat box!
• Data
• Values of those features
• What is data against features in the sales record table?
15
BITS Pilani, Pilani Campus
Data Sources
• Primary sources
Is store_inventory.xlsx data
• You collect the data first hand (Examples?) primary or secondary?
• Surveys
• Personal contact, phone, email, online etc.
• Experiments
• Randomized trials (Covid vaccine?)
• Business activity
• Production process
• Secondary sources
• You use the data collected by other sources?
• https://reuters.com/
• List of prospects (leads) 16
BITS Pilani, Pilani Campus
Data Sources
Is store_inventory.xlsx data
• Unstructured data (?) structured or unstructured?
• Texts / Tweets
• Sentiment analysis
• Are customers saying positive things about my brand?
• Images
• Pictures of products to determine faults
• Videos
• Which ad evokes positive reactions?
17
BITS Pilani, Pilani Campus
Answering business questions with data
• Population or Sample?
• Population study: We use data from all the units for analysis
• Sample study and inference
• We use data from a carefully drawn sample of the population
• We infer population parameters from the sample analysis
• What is the mean height of this class?
• Is Population study possible? (Type “y” in the chat box if yes)
• Data from all the units can be collected and used for the analysis
• Exit poll (who is likely to win the election?)
• Is collecting data from entire population possible?
• A sample from the population is used to answer the question
18
BITS Pilani, Pilani Campus
Sampling Methods
• Non-probability sampling
• Judgement sample (when do we use this?)
• Convenience sample (When do we use this?)
• Probability Sampling
• Simple Random Sampling
• Systematic Sampling
• Stratified Sampling
• Cluster Sampling
20
BITS Pilani, Pilani Campus
Simple Random Sampling
21
BITS Pilani, Pilani Campus
Simple Random Sampling
23
BITS Pilani, Pilani Campus
Systematic Sampling
24
BITS Pilani, Pilani Campus
Stratified Sampling
27
BITS Pilani, Pilani Campus
Today’s content
28
BITS Pilani, Pilani Campus
Q&A
• Questions about
• Objectives
• Content
• Anything else
29
BITS Pilani, Pilani Campus
Quantitative Methods
Lecture-2
BITS Pilani
Pilani Campus
1
BITS Pilani
Pilani Campus
✓ Session 1:
√ Defining and collecting data
√ Survey and sampling methods
➢ Session 2:
➢ Organizing and visualizing variables
➢Ch 2 & 3 Business Statistics, Levine et al.
3
BITS Pilani, Pilani Campus
Focus and mode
▪ Concept clarity
▪ Ability to apply concepts
▪ Everything should flow from your business or managerial questions
▪ Active participation and discussions
4
BITS Pilani, Pilani Campus
Why organize?
columns
To pictorial presentation
▪ A visual summary can be revealing
▪ Spread
▪ Distribution
▪ Relationships
▪ Trends
6
BITS Pilani, Pilani Campus
What are we organizing or picturizing?
7
BITS Pilani, Pilani Campus
Variables
8
BITS Pilani, Pilani Campus
Variables
✓ Categorical
✓ Numerical
• Based on scales
– Nominal (categorical)
– Ordinal
– Interval
– Ratio
9
BITS Pilani, Pilani Campus
1. Nominal scale
▪ Measurements
▪ Data can be categorized and counted; cannot be measured or ranked.
10
BITS Pilani, Pilani Campus
Nominal data- frequency and proportion
table
Store inventory data
• Microsoft Spreadsheet
• Insert
• Pivot table
• Recommended
• Select entire table
• Start with blank table
• Add type to rows and values
• Value field settings can be
changed to % of column as well
• You can work with multiple
variables together by adding
them to rows or columns
11
BITS Pilani, Pilani Campus
Nominal data- bar charts and pie charts
12
BITS Pilani, Pilani Campus
Variables
✓ Categorical
✓ Numerical
• Based on scales
✓ Nominal – Frequency, percentages, bar and pie charts
– Ordinal
– Interval
– Ratio
13
BITS Pilani, Pilani Campus
2. Ordinal data
14
BITS Pilani, Pilani Campus
Ordinal data
Price category:
Low: 0-25
Medium: 26-50
High: >50
15
BITS Pilani, Pilani Campus
Ordinal data- Frequency & Cumulative
frequency table & Ogive chart
Ogive is
cumulative
frequency
line
16
BITS Pilani, Pilani Campus
Variables
✓ Categorical
✓ Numerical
• Based on scales
✓ Nominal – Frequency, percentages, bar and pie charts
✓ Ordinal – Nominal + cumulative frequency charts
– Interval
– Ratio
17
BITS Pilani, Pilani Campus
Interval scale
18
BITS Pilani, Pilani Campus
US/UK/EU shoe sizes are on Interval scale-
because their zero size will not be of zero length
19
BITS Pilani, Pilani Campus
Interval data
20
BITS Pilani, Pilani Campus
Interval data- Histogram, Cumulative
frequency
Fig: Histogram of number of products by price buckets (bins) (Store Inventory Data)
21
BITS Pilani, Pilani Campus
Variables
✓ Categorical
✓ Numerical
• Based on scales
✓ Nominal – Frequency, percentages, bar and pie charts
✓ Ordinal – Nominal + cumulative frequency charts
✓ Interval - Ordinal + Distribution chart (histogram)
– Ratio
22
BITS Pilani, Pilani Campus
Ratio scale
23
BITS Pilani, Pilani Campus
Ratio scale charts
153 Range Frequency
154 150-160 3
154 160-170 3
162 170-180 5
165 180-190 4
169 190-200 1
172 Total 16
176
176 Stem Leaf
176 15 3 4 4
177 16 2 5 9
180 17 2 6 6 6 7
182 18 0 2 6 7 Stem-and-Leaf diagram
186 19 0 is like a histogram,
187 without losing the data.
190
24
BITS Pilani, Pilani Campus
BITS Pilani
Pilani Campus
25
Two or categorical variables- Column
charts
Gender
f m Total
fr 3 2 5
Class
so 11 12 23
jr 7 11 18
sr 3 1 4
Total 24 26 50
Two variables are- Gender (f/m) and Class (fr, so, jr, sr).
26
BITS Pilani, Pilani Campus
Two numerical variables- Scatter plot
27
BITS Pilani, Pilani Campus
Two variables- Line chart
Year 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016
No (miliion) 2.54 2.38 2.73 3.46 3.92 4.45 5.08 5.28 5.17 5.78 6.31 6.58 6.97 7.68 8.03 8.80
28
BITS Pilani, Pilani Campus
Two or more variables- Stock chart
Frequency table
One nominal variable- Blood Group
Contingency table
Three nominal variables- Blood group, Gender and Rh
Contingency table
Two nominal variables- Blood Group and Ethnicity
BITS Pilani, Pilani Campus
Visual representation- charts
1 2 3
1 Pie chart
2 Column chart
3 Side-by-side chart
4 Stacked row chart
5 Stacked column chart
4 5
33
Quantitative Methods
Lecture-3
BITS Pilani
Pilani Campus
1
BITS Pilani
Pilani Campus
✓ Previous Sessions
√ Defining and collecting data
√ Survey and sampling methods
√ Organizing and visualizing variables
➢ Session 3:
➢ Numerical descriptive measures
3
BITS Pilani, Pilani Campus
Nominal / Categorical
4
BITS Pilani, Pilani Campus
Numerical measures
5
BITS Pilani, Pilani Campus
Central tendency measures for raw data
7
BITS Pilani, Pilani Campus
Central tendency measures for raw data
▪ Mode
▪ Value of most frequently occurring observation in the data
▪ Examples:
▪ 2 2 3 4 5, Mode value= (?)
▪ 2 2 3 4 5 (Mode value =2)
▪ 22 30 40 40 50 50 66 (Mode value= ?)
▪ 22 30 40 40 50 50 66 (Mode values= 40 and 50)
▪ Bi modal
▪ 1, 2, 3, 4, 5 (Mode value= ?)
▪ May not have any Mode
8
BITS Pilani, Pilani Campus
When to use which measure
▪ Mean
▪ Data should be approximately equally spread about the center
▪ Median
▪ When there are extreme values
▪ Skewed distribution of data
▪ Salary offered to collage graduates
▪ Mode
▪ Rarely used for numerical data
▪ Who wins the election? (Modal voted candidate)
▪ For categorical data – it is the only measure available
▪ Highest frequency
10
BITS Pilani, Pilani Campus
Others means
▪ Geometric mean
▪ Only works with positive numbers
▪ High volatility, different units
▪ Harmonic mean
▪ When greater weight needs to be given to HM = n/ σ𝑛𝑖=1 1/𝑥𝑖
smaller values (Outlier issues)
▪ Averages ratios and rates = n/(1/𝑥1 + 1/𝑥2 … 1/𝑥𝑛)
▪ AM>GM>HM
11
BITS Pilani, Pilani Campus
Mean of Grouped Data
∑f = 80 ∑f.x= 1950
Note: Mean of Raw data is generally not equal to mean of grouped data (why?)
12
BITS Pilani, Pilani Campus
Median of Grouped Data
13
BITS Pilani, Pilani Campus
Mode of Grouped Data
14
BITS Pilani, Pilani Campus
Few properties of Mean, Median, Mode
Change in the value of any Change in the values may not Change in the values may not
observation always affects affect Median. affect Mode.
AM. 123456789 Blue Green Red Red Red Yellow
1 2 3 4. AM=2.5. 1 2 3 4 5 6 7 8 10000000 Mode remains Red even if
1 2 3 8. AM=3.5. Yellow is replaced by Blue.
AM cannot be computed if all Median may be computed even May be computed even if values
values are not available. if values of all observations are of all observations are not
1 2 3 X. AM=? not available. available.
12345679X 1233334X
The Median will remain the The Mode will remain the same
same even if the largest value X even if value X is unknown.
is unknown.
15
BITS Pilani, Pilani Campus
BITS Pilani
Pilani Campus
Variation
16
Variation in daily life
6
5
4
3
2
1 3 6 4 2 4 1 4 2 1 3
6
5 Manpower deployment
4
3
2
1 3 3 3 3 3 3 3 3 3 3
Sample Data
2
5
7
10
15
Min 20
Range?
18
20
BITS Pilani, Pilani Campus
Highest and Lowest variations (By Range)?
Days
▪ Variation: C > B > D > A
21
BITS Pilani, Pilani Campus
Range- Uses and shortcomings
Stock price during a day
Uses
▪ Stock price- minimum and maximum in a day.
▪ Ambient temperature- minimum and maximum in a day.
▪ Blood pressure- high and low within few minutes.
▪ Range is computed only from two observations. Hence, easy Temperature during a day
to compute.
Shortcomings
Range is computed only from two observations,
• Does not capture distribution of variation
• Not suitable for data with extreme values
31 41 5 9 26 53 58979 3 23 ...
Range = (58979-3) = 58976.
22
80 80 80
60 60 60
40 40 40
20 20 20
0 0 0
A B C D E F G H I J K L A B C D E F G H I J K L A B C D E F G H I J K L
80 80 80
60 60 60
40 40 40
20 20 20
0 0 0
A B C D E F G H I J K L A B C D E F G H I J K L A B C D E F G H I J K
24
BITS Pilani, Pilani Campus
BITS Pilani
Pilani Campus
25
Higher variation, Red or Blue?
Sensex Healthcare
Minimum 35,414 16,169
Maximum 38,493 18,630
Mean 37,077 17,026
Range 3,079 2,461
Std. Dev. 841 715
26
BITS Pilani, Pilani Campus
Coefficient of Variation, CoV
Sensex Healthcare
Minimum 35,414 16,169 ▪ Coefficient of Variation (CoV) =
Maximum 38,493 18,630 Standard deviation/Mean
Mean 37,077 17,026
Range 3,079 2,461
Std. Dev. 841 715
CoV
(=Std Dev/Mean) 0.023 0.042
▪ According to CoV, Healthcare index has • What is the unit of standard deviation?
higher variation. • What is the unit of CoV?
▪ When means of two data differ a lot,
▪ Units are different
▪ CoV may capture the variation better than
Standard deviation.
27
BITS Pilani, Pilani Campus
BITS Pilani
Pilani Campus
Z score
28
Z score
Z score of 1, 2, 3, 4, 5? Mean = 3.
▪ Z-Score
▪ Not a summary measure
▪ It is computed for each data point.
29
BITS Pilani, Pilani Campus
Z scores- Example and Uses
Uses
▪ To identify Outliers (extreme values).
▪ Z value < -3 or > 3 are often considered Outliers.
▪ To read Normal distribution table (Chapter-6)
-3 -2 -1 0 1 2 3
▪ To estimate Confidence Intervals (Chapter-8) Z score
▪ To test Hypothesis (Chapter 9,10, and 11).
30
BITS Pilani, Pilani Campus
BITS Pilani
Pilani Campus
31
Symmetry (or lack) of frequency distributions
Mean < Median < Mode Mean = Median = Mode Mean > Median > Mode
Tail on the left, -ive Skewed Symmetric Tail on the right, +ive Skewed
Ex: Japan’s population age Ex: Distribution of height Ex: Wealth, income, family size
Symmetric, Bell Symmetric, Bell Symmetric and Negatively skewed, Positively skewed, Another Positively
shaped, high shaped, less flattest. There is tail on left side. tail on right side. skewed, tail on right
concentration in the concentration in the no mode. side. There is no
middle. middle. mode.
Mean=Median=Mode Mean=Median=Mode Mean=Median Mean<Median<Mode Mode<Median<Mean Median<Mean
33
BITS Pilani, Pilani Campus
HW…. A tale of 3 exams
34
BITS Pilani, Pilani Campus
BITS Pilani
Pilani Campus
35
Flatness (or Peakedness) of a frequency distribution
Quartiles
37
Quartiles (from Quarters)
5-number summary
39
5-number summary
Dataset 5-numbers
The dataset is summarized by following 5 40 40
50
numbers-
60
80 Q1=90, = (100+80)/2 90
1. Minimum
100
2. Q1- Quartile 1 110
3. Q2- Quartile 2 120
180 Q2=200, (220+180)/2 200
4. Q3- Quartile 3 220
5. Maximum 300
600
700 Q3=800, =(700+900)/2 800
▪ Usage 900
▪ To study variation in the data, 910
▪ Quick symmetry assesment 930
950 950
▪ Used in Boxplots.
5-number summary of above dataset-
40, 90, 200, 800 and 950
Boxplots
41
Boxplot
▪ A visual representation of 5- number Dataset 5-numbers
950 950
summary. A box over the 5-numbers- Min, 930
Max
Wherever there are outliers, the whisker line ends at Q3+1.5IQR (if outliers are on the higher side) or at Q1-1.5IQR
(if outliers are on the lower side)
BITS Pilani, Pilani Campus
Typical Boxplots
Boxplot Lowest Lowest Lowest Lowest 1 5
Comments
No 25%, Q1 50%, Q2 75%, Q3 100%, (All)
1 25 5 5 25 Symmetric, narrow IQR
2 20 20 20 20 Symmetric
3 20 30 30 20 Symmetric
4 35 15 15 35 Symmetric
Symmetric 2 6
5 10 40 40 10 Symmetric, wide IQR
6 25 5 5 25 Symmetric, low (30) median
7 45 10 10 15 Left skewed
8 20 5 10 45 Right skewed
3 7
4 8
43
BITS Pilani, Pilani Campus
Take 5… Boxplots stories
Age
44
BITS Pilani, Pilani Campus
BITS Pilani
Pilani Campus
45
MS Excel functions….1/2
46
BITS Pilani, Pilani Campus
MS Excel functions….2/2
=Quartile.Inc(Array,#Q)
(Q= 1,2,3)
47
BITS Pilani, Pilani Campus
Numerical Description Measures
Lecture-4
BITS Pilani
Pilani Campus
1
BITS Pilani
Pilani Campus
Probability – Part I
(Ch 4 Business Statistics, Levine et al.)
So far and the next
✓ Previous Sessions
√ Defining and collecting data
√ Survey and sampling methods
√ Organizing and visualizing variables
√ Numerical descriptive measures
➢ Today
➢ Probability (Part I)
3
BITS Pilani, Pilani Campus
Why learn probability?
▪ We ideally prefer certainty, however most things are uncertain.
▪ What is uncertainty?
▪ Faced with uncertainty, how do we make rational decisions?
▪ Should I hire the candidate I interviewed for the job?
▪ What is the chance of the prospective hire performing well in the job?
▪ Should I approve the loan application on the table?
▪ What is the chance of the loan seeker paying the loan back?
▪ Should I do an MBA?
▪ What is the chance of getting a better job if I invest money and 2 years in an MBA?
▪ Study of probability helps us make sense of uncertainty
▪ Helps us quantify “the questions about chance of an event happening”
▪ From “perhaps” or “likely” or “unlikely” to say “50%”, “70%” or “25%” 4
BITS Pilani, Pilani Campus
Better decision can be taken if uncertainty is
measured
▪ What is probability?
▪ Chance or likelihood of an event
▪ Random Experiment
▪ Exact outcome can not be predicted with certainty
▪ But outcome is always one of the possible knowns
▪ Sample space: Contains all possible outcomes/events
▪ Natural Experiment: Chance of rain for example
▪ Simple event and joint events
▪ One feature v/s more than one features
▪ Will it be a 4? Will it be 4 & 2 on two consecutive rolls?
6
BITS Pilani, Pilani Campus
Probability
7
BITS Pilani, Pilani Campus
Probability?
8
BITS Pilani, Pilani Campus
Getting values of probability
1. A priori
▪ Classical/Equi-likely.
▪ Textbook examples of Coin tossing, Playing cards,
etc, or when you know nothing.
2. Empirical
▪ From historical data, observations, or experiments.
▪ Life tables in insurance, earthquakes, rainfall, twins,
quality, stock market …
3. Subjective
▪ Personal judgement.
▪ Outcome of India vs Brazil cricket match outcome.
Covid-19 will be completely over in 2028…
9
BITS Pilani, Pilani Campus
BITS Pilani
Pilani Campus
A priori probability
Probability- a priori
𝑁𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑜𝑢𝑡𝑐𝑜𝑚𝑒𝑠 𝑖𝑛 𝑤ℎ𝑖𝑐ℎ 𝑡ℎ𝑒 𝑒𝑣𝑒𝑛𝑡 𝑜𝑐𝑐𝑢𝑟𝑠
𝑃𝑟𝑜𝑏𝑎𝑏𝑖𝑙𝑖𝑡𝑦 =
𝑇𝑜𝑡𝑎𝑙 𝑛𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑝𝑜𝑠𝑠𝑖𝑏𝑙𝑒 𝑜𝑢𝑡𝑐𝑜𝑚𝑒𝑠
Tossing a coin-
▪ Outcomes- Head or Tail.
▪ P(Head) = P(Tail) = ½.
Births-
▪ Outcomes- Male or Female.
▪ P(Male)=P(Female)= ½.
Playing cards-
▪ Outcomes- 26 Black or 26 Red.
▪ P(Red)= P(Black)= 26/52 = ½.
11
Number of outcomes in which the event occurs Total number of possible outcomes
1. P(4)=1/6. 1 1, 2, 3, 4, 5, 6.
2. P(5)= 1/6. 1 1, 2, 3, 4, 5, 6.
3. P(Even)= 3/6. 3 1, 2, 3, 4, 5, 6.
4. P(<5)= 4/6. 4 1, 2, 3, 4, 5, 6.
5. P(<=5)= 5/6. 5 1, 2, 3, 4, 5, 6.
6. P(Divisible by 3)= 2/6. 2 1, 2, 3, 4, 5, 6.
7. P(Divisible by 5)= 1/6. 1 1, 2, 3, 4, 5, 6.
8. P(Prime)= 3/6. 3 1, 2, 3, 4, 5, 6.
Empirical probability-
From experiments or observations
Empirical Probability
• The probability is computed from experiments,
observations, surveys, etc.
• Proportion of times an event occurs
• If a dice is rolled 10, 100, 500 or 1000 times
• Actual proportion of times a 4 would appear
• Will it be 1/6 or 0.167?
Item Probability
Left-handed 1 : 10 persons
Twins 3 : 100 births
Breast Cancer 1 : 8 Women in US
17.2 in 100 male smokers
Lung Cancer
11.6 in 100 females smokers
15
BITS Pilani, Pilani Campus
Empirical probability computation-
Examples
.
S&P BSE Sensex observed for 26 days- 11
Range Frequency Probability*
times Down and 14 times Up.
20-30 1 0.01
30-40 40 0.26
▪ P(Down) = 11/25 = 44%. 40-50 76 0.50
▪ P(Up) = 14/25 = 56%. 50-60 26 0.17
60-70 6 0.04
70-80 1 0.01
80-90 1 0.01
Total 151 1
* or Relative Frequency 16
BITS Pilani, Pilani Campus
Using probability to make decisions:
Expected value
Expected value: E[X] = ∑xip(xi)
• xi = The values X takes
• p(xi) = The probability that X takes value xi
• ∑xip(xi) = x1p(x1) + x2p(xn) + … + xnp(xn)
• n: Total number or possible outcomes
• For Roulette-A
• Probability of Blue, Yellow, Red and Green is 9%, 6%, 70% and 15% Respectively
• You are offered Rs 10 for Blue, Rs 20 for Yellow ,Rs 30 for Red and Rs 40 for Green
• Game Fee is Rs 30
• Should you play this game? Should you offer this game?
• Expected value E[X]: x1p(x1) + x2p(x2) + x3p(x3) + x4p(x3)
• 10*0.09 + 20*0.06 + 30*0.70 + 40*0.15 = 0.9 + 1.2 + 21 + 6 = 29.1
• Note: Only likely to hold in large number of trials
17
BITS Pilani, Pilani Campus
BITS Pilani
Pilani Campus
Subjective probability
Subjective probability
3. Sports betting-
▪ P(IndiaWillWin) = 0.40. BookieA.
▪ P(IndiaiWillWin) = 0.45. BookieB.
▪ P(IndiaWillWins) = 0.70. BookieC.
19
BITS Pilani, Pilani Campus
BITS Pilani
Pilani Campus
21
Joint Events
• Simple probability
• p(y) = p (planned to purchase)
• 250/1000 = ¼ = 0.25
• Complement
• p( did not plan to purchase) = p(ȳ ) = 1 – p(y)
Contingency Table
• 0.75
• Joint Probability:
• P (planned to purchase & actually purchased) = p(x and Y)
• 200/1000 = 1/5 = 0.2 x x∩y y
• p(x ∩ Y) ; ∩ : Intersection symbol (300) 200 250
• Addition Rule
• p(x or y) = p(x U y) = p(x) + p(y) – p(x∩y)
• U: Union symbol Venn Diagram
• Marginal Probability
• Event A occurs with one or other events
B1, B2, B3…. Bn
• Marginal probability of A: P(A()
• Sum of joint probabilities with all B1, B2,
…. Bn
• P(A) = P( A and B1) + P (A and B2)
+….= P(A and Bn)
• B1, B2, …, Bn are mutually exclusive Contingency Table
and collectively exhaustive events
occurring with event A P(y) = p (y ∩ x) + p (y ∩ X̄)
200/1000 + 50/1000
Marginal Diamond
1. P(Red)= 26/52 = 1/2.
2. P(King)= 4/52. Club
3. P(7) = 4/52.
4. P(Picture) = 12/52. Heart
5. P(Diamond) = 13/52.
Spade
Joint
5. P(Red and King) = 2/52.
Marginal probability- only one event occurs. P(Red) means the
6. P(Diamond and Red) = 13/52. probability that the card is of Red color.
7. P(Picture and Red) = 6/52.
Joint probability- both events occur. P(Red and King) means the
8. P(Black and Red) = 0/52. probability that the card is of Red color and it is also a King.
9. P( <3 and Red) = 4/52.
26
27
Quantitative Methods
Lecture-5
BITS Pilani
Pilani Campus
1
BITS Pilani
Pilani Campus
Probability – Part II
(Ch 4 Business Statistics, Levine et al.)
So far and the next
✓ Previous Sessions
√ Defining and collecting data
√ Survey and sampling methods
√ Organizing and visualizing variables
√ Numerical descriptive measures
√ Probability (Part I)
➢ Today
➢ Probability (Part II)
3
BITS Pilani, Pilani Campus
• Two people
• Every person can either be a Yes or a No
• How many arrangements are possible
• Yes, No
• Yes, Yes
• No, Yes
• Yes, No
4
Sample space – some more exploration
• Sample space depends on how you frame the experiment
• Lets consider only one feature of the previous example
• Frame 1: Nature generates a visitor out of its own magic with two
possibilities
• Sample space: S = {Yes, No}
• Are these equally likely outcomes? Is probability P(Yes) = ½?
• Frame 2: Equally likely sample space
• Treat 1000 store visitors’ data like a pack of 1000 independent cards
• Each card is marked as one of the two values (250: Yes, 750: No)
• S= { 750-No, 250-Yes)
• Nature randomly picks a card with replacement (every card is equally likely)
• What is the probability that the next visitor plans to purchase?
• Frame 3: Drawing 1000 independent persons from a population
• Sample space - { All permutations of a thousand Yes or No possibilities}
• Total: 2X2….X2 (1000 times) = 21000 values 5
BITS Pilani, Pilani Campus
BITS Pilani
Pilani Campus
Conditional probability
6
Conditional Probability
• Conditional Probability
• Probability of Event A occurring, given
event B has occurred
• Narrows down the sample space
• Sample space of x | y?, x| ȳ?
• P (A | B)
• Probability of A given B
P(AB) Contingency Table
• P(A|B) = P(B)
Probability of “actual purchase” Probability of “purchasing” given Also can be computed from
given “plans to purchase” “does not plan to purchase” the new narrowed sample space
P(x| y) = p (x ∩ y) / p (y) P(x| ȳ ) = p (x ∩ ȳ) / p (ȳ) Sample space of x | y? and x| ȳ?
P(x| y) = 200 /250 = .8
= (200/1000) / ( 250/1000) = (100/1000) / ( 750/1000) P(x| ȳ ) = 100 /750 = 0.133
= 200 /250 = .8 = 100 /750 = 0.133
= ½= 2/4
Club
P(Red | 7)
=1/2 Heart
P(Picture | Diamond) Conditional probability- P(King | Red) means the probability that the
card is a King given that you have the information that the card
3/13 is a Red Card
11.P(Diamond|Red)= 13/26. P(Red|King): If the card is a King, what is the probability it is of Red color? 2/4=1/2.
P(<7/Red): If the card is of Red color, what is the probability it is <7? 12/26. 10
11
BITS Pilani, Pilani Campus
Application of Conditional Probability
Medical diagnosis
12
BITS Pilani, Pilani Campus
Independence
Total
• Independence 1000
•
purchase to purchase
Information about one event having occurred does 250 750
not help narrow down the sample space
• P (A | B) = P (A) ; Purchase: Yes Purchase: No Purchase: Yes Purchase: No
• ‘|’ is read as: “conditional on” or “given” 200 50 100 650
• Joint Probability
For a toss of a fair coin.
P(AB) What is the probability of getting
• P(A|B) = P(B)
4 heads in a row?
• P(AB) = P (A|B).P(B)
• Note: P(AB )= P(A and B) = P(A∩B)
• P(Head) = P(H) = ½
• 4 tosses are 4 independent events
• For Independent Events • P( H, H, H, H) = P(H).P(H).P(H).P(H)
• P(A | B) = P(A) • = (1/2)4
• P(A and B) = P(A). P(B) • = 1/16
P(Purchased) =
P(Purchased | Planned:Yes)* P (Planned:Yes)
+
P(Purchased | Planned:No)* P (Planned:No)
Contingency Table
BITS Pilani, Pilani Campus
Multiplication Rule and marginal probability
Total
Marginal Probability P(Purchased) =
1 P(Purchased | Planned:Yes) * P (Planned:Yes)
+
Does not plan to
P(Purchased | Planned:No) * P (Planned:No)
Plans to purchase
purchase
0.25
0.75
Identify Worst Up
Up
0.36
Down
0.24
Total
0.60
A Forecast
Economist Down
Total
0.24
0.60
0.16
0.40
0.40
1.00
Up Down Total
▪ The track record of four astrologers in predicting whether
Indian football team will win (replace Up with Win) or lose Up 0.60 0.00 0.60
(replace Down with Lose) is given in the contingency tables. C Forecast
Down 0.00 0.40 0.40
Total 0.60 0.40 1.00
Up Down Total
▪ Identify the worst economist?
Up 0.00 0.60 0.60
▪ Rank all economists and show all calculations. D Forecast
Down 0.24 0.00 0.24
Hint: Use conditional probability.
Total 0.24 0.60 0.84
20
BITS Pilani, Pilani Campus
Imperfect ‘classification machines’
22
BITS Pilani, Pilani Campus
Counting Methods (1/4)
23
BITS Pilani, Pilani Campus
Counting Methods (2/4)
Rule 2: IF there are “K1” possible outcomes in 1st trial, K2 in 2nd and so
on
– Total number of possible outcomes = K1*K2*….
Example:
Possible number plates if the number consists of 2 alphabets followed
by 2 numbers?
26*26*10*10 = 67600
24
BITS Pilani, Pilani Campus
Counting Methods (3/4)
25
BITS Pilani, Pilani Campus
Counting Methods (4/4)
Rule 4: Permutation
– Total possible arrangements of “r” objects chosen from “n” objects
!𝑛
– 𝑛𝑃𝑟 =
!(𝑛−𝑟)
– How many ways can 2 alphabets taken from A, B, C and D be arranged?
• ! 4/! 2 = 24/2 = 12
Rule 5: Combination
– Total possible way of selecting “r” objects from “n” objects irrespective of order
!𝑛
– 𝑛𝐶𝑟 =
!𝑟!(𝑛−𝑟)
– How many ways can the 2 alphabets be taken from A, B, C and D?
• ! 4/(! 2 ∗ ! 2) = 24/(2*2) = 6
26
BITS Pilani, Pilani Campus
Situated Learning Assignment (3 Marks)
• Take a data from your work context
• Identify datascale of different variables
– Nominal, ordinal, interval, ratio
• Compute measures of central tendency and dispersion
– Arithmetic mean
– Dispersion: Next slide
– Calculations: By hands (calculator is allowed but not MS XL)
• Suitable graphs (using MS XL)
– Depends on variable types
– For interval and ratio with histograms
• You can comment about skewness and kurtosis
27
Measuring variation
1. Range = Maximum-Minimum
2. Variance, population = σ2 = 1/N * ∑ (xi-Mean)2
3. Standard deviation, population =σ
4. Coefficient of Variation, population = σ/Mean
5. Variance, sample = s2 = 1/(N-1) * ∑ (xi-Mean)2
6. Standard deviation, sample =s
7. Coefficient of Variation, sample = s/Mean
8. Mean absolute deviation = 1/N * ∑ |xi-Mean|
9. Z score (how many std devns is xi
away from the mean) = [xi-Mean]/ σ
1. Quartiles (Q1, Q2, Q3) Smallest 25%, 50%, 75% observations.
2. Inter-quartile range = Q3 – Q1
3. 5-number summary (Min., Q1, Q2, Q3, Max.) Minimum, 3 Quartiles, Maximum
13. Boxplot (Called Box and Whisker chart in MS Excel) Plot of 5-number summary
BITS Pilani, Pilani Campus
Assignment Reporting Example
• How to calculate manually and report
• 5 points summary of dataset { 10, 20, 30, 40, 50, 60}
– Min: 10
– Q1: (n+1)/4th number = 7/4tg = 1.75th = 10 + (20-10)*0.75 =
17.5
– Q2 = (n+1)/2th number = 7/2th = 3.5th = 35
– Q3 = (3/4)*(n+1)th = 5.25th = 52.5
– Max: 60
– 5 Point summary = { 10, 17.5, 35, 52.5, 60}
• You can use XL for graphs and to verify your results
29
Q&A
30
Quantitative Methods
Lecture-6
BITS Pilani
Pilani Campus
1
BITS Pilani
Pilani Campus
✓ Previous Sessions
√ Defining and collecting data
√ Survey and sampling methods
√ Organizing and visualizing variables
√ Numerical descriptive measures
√ Probability
➢ Today
➢ Discreet Probability Distributions
3
BITS Pilani, Pilani Campus
Sample space and Random Variable
• You have 2 machines in your factory
• Each machine can be “working” or “not-working” decided by a random
process
• Sample space?
S = { “Working, Working”,
“Working, Not-Working”,
“Not-Working, Working”,
“Not-working, Not-Working” }
– Does the sample space contain numbers?
• A “Random Variable (RV)” maps the sample space on a real number line (R)
• Can take some or all real values between -∞ and ∞
• Example 1: R
-1 0 1 2 3
• Random Variable: X, representing number of working machines on a given day.
• How many values can X take?
• X = { 0, 1, 2 }
• Sample space of an Random Variable X consists of Real Numbers 0, 1 and 2
5
BITS Pilani, Pilani Campus
Sample space and Random Variable
• A “Random Variable (RV)” maps the sample space on a real number line (R)
• Can take some or all real values between -∞ and ∞
S={
“Working, Working”,
“Working, Not-Working”,
“Not-Working, Working”,
“Not-working, Not-Working” }
• Example 2: -1 0 1 2 3 R
• Random Variable: Y, representing whether all the machines are working today.
• Takes value 1 if all the machines are working, 0 otherwise
• How many values can Y take?
• Y = { 0, 1 }
• Sample space of an RV consists of Real Numbers
6
BITS Pilani, Pilani Campus
Discreet and Continuous Random Variables
• A “Discreet Random Variable (RV)”
• Takes discreet values
• Previous example (Note: There were no values for X or Y between 0 and 1)
• Number of students present in this class on a given day, number of questions in an exam paper
• A “Continuous Random Variable (RV)” can take any (infinite values) between
any two numbers
• Height of the students of this class
• Diameter of a machine component
7
BITS Pilani, Pilani Campus
Probability Distribution of a Discreet RV
• Probability distribution of a discreet RV is all the possible (Value, Probability) pairs
• Also called probability mass function (PMF)
• Example: You have two machines in your factory. Probability of a machine working
on a given day is 0.8.
• Random variable X represents number of machines working on a given day.
• What is the probability distribution of X P(X)
• {(0, 0.04), (1, 0.32), (2, 0.64)} .64
X
0 1 2
X Probability Cumulative
Probability Cumulative Probability distribution of X
0 0.04 0.04
1 0.32 0.36
2 0.64 1 • What is P (X <=0.5)?
Total 1 • What is P (X<3)?
9
BITS Pilani, Pilani Campus
Expected Value of a Random Variable
• E[X] = µ = σ𝑁
𝑖=1 𝑥𝑖 𝑃(𝑋 = 𝑥𝑖 )
• N= total number of values
• 𝑥𝑖 = ith value
• 𝑃(X = 𝑥𝑖 ) probability of X taking value xi P(X)
12
BITS Pilani, Pilani Campus
BITS Pilani
Pilani Campus
Binomial distribution
Binomial Distribution
• Binomial Random Variable
• A random variable representing number of successful events in n trials
• Properties of a binomial distribution
– The sample has fixed number of observations: n
– Each observation consists of the possibility of two mutually exclusive and
collectively exhaustive outcomes
– Probability of the event of interest is constant across observations. So, P
(Event) is fixed
– Value of any observation is independent of any other observation
14
BITS Pilani, Pilani Campus
Binomial Distribution
For toss of a coin experiment, the Random Variable X represents number of heads in
10 trials
Is X a Binomial RV?
• Does X represent number of successful events in n trials?
• Does the sample have fixed number of observations: n?
• Does each observation consist of the possibility of “two” mutually exclusive and collectively
exhaustive outcomes?
• Is the probability of the event of interest constant across observations?
• Does the value of any observation independent of any other observation?
• X is a Binomial RV
15
BITS Pilani, Pilani Campus
Binomial Distribution
• If a random variable X is distributed Binomially, then
• P ( X = x | n, π)
– Probability of x number of events occurring given parameters
– n: total number of trails/observations and
– Π: probability of the event or probability of success
• P( X = x | n, π) = 𝐶𝑥𝑛 𝜋 𝑥 (1 − 𝜋)𝑛−𝑥
𝑛!
• 𝐶𝑥𝑛 =
𝑥!(𝑛−𝑥)!
• E[X] = nπ
• Variance of a binomial distribution: σ2= nπ(1-π)
16
BITS Pilani, Pilani Campus
Binomial Distribution
• Probability distribution of ‘x’ machines failing out of total ‘10’
• Or ‘x’ heads in 10 trials of a coin
• For different values of probability of the event (π)
π=0.8, n=10
π=0.2, n=10 π=0.5, n=10 0.35
0.35 0.3
0.3
0.3 0.25
0.25
0.15 0.1
0.1
0.1 0.05
0.05
0
0.05
0 1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10
0
1 2 3 4 5 6 7 8 9 10
17
BITS Pilani, Pilani Campus
Binomial Distribution
•
5 0.0295 0.0480 1
E[X] = 50*0.2 = 10 6 0.0554 0.1034 1.2
• What is the chance that less than 5 7 0.0870 0.1904 1.4
8 0.1169 0.3073 1.6
machines would be out of order? 9 0.1364 0.4437 1.8
• P(X<=4) = 0.0185 10
11
0.1398
0.1271
0.5836
0.7107
2
2.2
• What is the chance that exactly 5 or 12 0.1033 0.8139 2.4
13 0.0755 0.8894 2.6
10 machines would be out of order 14 0.0499 0.9393 2.8
• P(X=5) + P(X=10) = .0295 + 0.1398 15 0.0299 0.9692 3
21
BITS Pilani, Pilani Campus
Other examples of binomial distributions
Poisson distribution
Poisson Distribution
24
BITS Pilani, Pilani Campus
Poisson Distribution
Requirements
– Probability of the event is same for all the areas of opportunity
– Number of events occurring in one area of opportunity is independent of
number of events occurring in other areas of opportunity
– The probability that two or more events will occur in an area of opportunity
approaches zero as the area of opportunity becomes extremely small
– Examples
• Number of customers arriving each minute during the lunch hour in a bank, number of
defects per sq inch area etc.
– Has one parameter λ (Lambda): Expected number of events per unit
25
BITS Pilani, Pilani Campus
Examples
26
BITS Pilani, Pilani Campus
Examples
Requirements
– Is the probability of the event same for all the areas of opportunity?
– Not a good example of Poisson distribution
27
BITS Pilani, Pilani Campus
Poisson Distribution: Probability, Expectation and Variance
28
BITS Pilani, Pilani Campus
Examples
λ =2 λ =8
0.3 0.16
0.25 0.14
0.12
0.2
0.1
0.15
0.08
0.1 0.06
0.04
0.05
0.02
0
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 0
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
29
BITS Pilani, Pilani Campus
What is the Probability distribution?
x Probability
0 0.0183
1 0.0733
2 0.1465
3 0.1954
4 0.1954
5 0.1563
6 0.1042
7 0.0595
8 0.0298
9 0.0132
10
…
0.0053 Solution of 1 above for Poisson distribution
Sum 1.0
30
BITS Pilani, Pilani Campus
BITS Pilani
Pilani Campus
• The average number of accidents reported in the factory is Number of Accidents P(x) Always Fast Best and Fast Carry Fast
4.2/month. Rate Expected Cost Rate Expected Cost Rate Expected Cost
• the manager of a factory has invited bids for ambulance service 2 0.132261 3000 793.57 4000 1058.09 0 0.00
to take injured workers to a nearby hospital. Bids submitted by 3 0.185165 3000 1666.49 4000 2221.98 0 0.00
three service providers are as follows- 4 0.194424 3000 2333.08 2000 1555.39 0 0.00
• BestAndFast services: Rs 4,000/case up to 3 cases in a month and Rs 8 0.036011 3000 864.27 2000 576.18 3000 864.27
2,000/case if cases in a month exceed 3. 9 0.016805 3000 453.74 2000 302.49 3000 453.74
• CarryFast services: A fixed amount Rs 8,000/month and Rs 3,000/case 10 0.007058 3000 211.75 2000 141.16 3000 211.75
if cases in a month exceed 5. 11 0.002695 3000 88.93 2000 59.29 3000 88.93
Which bid is the most economical? 14 9.14E-05 3000 3.84 2000 2.56 3000 3.84
33
Quantitative Methods
Lecture-7
BITS Pilani
Pilani Campus
1
BITS Pilani
Pilani Campus
Normal Distribution
(Ch 6 Business Statistics, Levine et al.)
So far and the next
✓ Previous Session
√ Discreet Probability Distributions
√ Probability mass function
➢ Today
➢ Continuous and Normal Distributions
3
BITS Pilani, Pilani Campus
Continuous Random Variables
• A “Continuous Random Variable (RV)” can take any
(infinite values) between any two numbers
• Height/marks of the students of this class
• Diameter of a machine component
• Point probability is always zero (Why?)
• Probabilities are defined for finite intervals (small or large)
• Probability Distribution of a continuous variable
• It’s a mathematical function
• Probability Density Function (PDF): 𝑓𝑋 𝑥
• Y axis is not probability
• It represents the values the PDF function takes
• Cumulative Probability Distribution Function (CDF): 𝐹𝑋 𝑥 =
𝑥
−∞ 𝑓𝑋 𝑥 𝑑𝑥
4
BITS Pilani, Pilani Campus
Calculating probabilities
• Probability is defined as area under the PDF curve, between two points
𝐵
• 𝑃 𝑋 ≥ 𝐴 𝑎𝑛𝑑 𝑋 ≤ 𝐵 = 𝑓 𝐴 𝑥 𝑑𝑥
Uniform PDF
5
BITS Pilani, Pilani Campus
Normal Distribution
• Also called Gaussian Distribution
Probability Desnsity Function
• Probability Density Function (PDF)
1 𝑋−µ 2
1 −
• f(X |µ, 𝜎) = 2
𝑒 2 𝜎
2𝜋𝜎
• µ = mean/expected value; 𝜎2 = Variance
15
100
0
5
10
20
25
30
35
40
45
50
55
60
65
70
75
80
85
90
95
Marks
0.6
𝑥
• 𝐹𝑋 𝑥 = −∞ 𝑓𝑋 𝑥 𝑑𝑥 0.4
0.2
100
65
0
5
10
15
20
25
30
35
40
45
50
55
60
70
75
80
85
90
95
6
BITS Pilani, Pilani Campus
Normal Distribution
• Two parameters define a normal distribution: µ and σ2
• Higher σ increases the spread, change in µ shifts the curve
0.8
85
100
0
10
15
20
25
30
35
40
45
50
55
60
65
70
75
80
90
95
8
BITS Pilani, Pilani Campus
Standardized Normal Distribution
• Distribution of Z values is called Standard Normal PDF (µ=50, σ=10)
Normal Distribution
𝑥𝑖 − µ
• Zi =
σ
• Z ~ N (0,1), µ = 0 and σ2 = 1
35
0
5
10
15
20
25
30
40
45
50
55
60
65
70
75
80
85
90
95
100
• X-axis for normal distribution:
Marks
-2.5
1.5
-5
-4.5
-4
-3.5
-3
-2
-1.5
-1
-0.5
0
0.5
1
2
2.5
3
3.5
4
4.5
5
Z 9
BITS Pilani, Pilani Campus
Normal Distribution
2.5
-4.5
-3.5
-2.5
-1.5
-0.5
0.5
1.5
3.5
4.5
-5
-4
-3
-2
-1
5
• Steps Z
• Calculate Z value of the value of interest 1
0.9
• (45.5-50)/10 = -0.45
0.8
0.7
0.6
• 0.3264 or 32.64%
-3.5
-5
-4.5
-4
-3
-2.5
-2
-1.5
-1
-0.5
0
0.5
1
1.5
2
2.5
3
3.5
4
4.5
5
12
BITS Pilani, Pilani Campus
Calculating Normal probabilities
• If X ~ N (μ=50, σ=10), then P(X>=45) and P(X<=55)? PDF
• What % of students have scores between 45 and 55
• Steps
• Calculate Z values of the values of interest
• P(X<=45) and P(X<=55), Z for 45 and 55?
-5 -4.5 -4 -3.5 -3 -2.5 -2 -1.5 -1 -0.5 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
-4.2
-4.6
-3.8
-3.4
-2.6
-2.2
-1.8
-1.4
-0.6
-0.2
0.2
0.6
1.4
1.8
2.2
2.6
3.4
3.8
4.2
4.6
5
-5
-3
-1
3
Z - CDF
Z - CDF
13
BITS Pilani, Pilani Campus
Calculating Normal probabilities
• If X ~ N (μ=50, σ=10), What % of the students have
scored more than 55 marks?
• Steps
• Calculate Z values of the value of interest, (Z for X=55?)
• Z = (55-50)/10 = 0.5
• Which of the shaded area is P(Z>=0.5)? 1
0.9
• P(Z>=0.5) = 1- P(Z<=0.5), why? 0.8
0.7
• P(Z>=0.5) = P(Z<=-0.5), why? 0.6
0.5
• Is P(Z<=-.5) = 1- P(Z<=.5)?
-2.6
-1.8
-5
-4.6
-4.2
-3.8
-3.4
-3
-2.2
-1.4
-1
-0.6
-0.2
0.2
0.6
1
1.4
1.8
2.2
2.6
3
3.4
3.8
4.2
4.6
5
• 1 – 0.6915 = 0.3085
Z - CDF
Z - CDF 14
BITS Pilani, Pilani Campus
How questions may be asked
• Given RV: X ~ N (µ, σ2)
• Probabilities for X between A and B [A and B can take any values between -∞, ∞]
• Proportions or values between a certain range
• Given proportions within ranges
• Do they represent normal distribution?
• Find whether proportions match with standard normal proportions under the curve
• Which interval will contain x% values [Top, bottom or around the mean]
• You want to award A grade to top 5% of the students, what will be the marks cut-off
• You want to promote top 5% or let-go bottom 5% of the performance score employees
• You want to report “95% range around the Mean”
• µ ± 1.96σ
• Using the distribution parameters X values can be converted to Z values, and
vise versa
15
BITS Pilani, Pilani Campus
How questions may be asked
• Steps to make life easy:
• Always visualize the bell shaped PDF
• Visualize the shaded areas of your interest X<=A
• Find cut-off z-values of interest
• Find cumulative probabilities for the z-values of
interest (from the Z cumulative prob table)
• That is area under the curve up-to those points from -∞
• Work with these values to find the answer
X between
X>=A
A and B
16
BITS Pilani, Pilani Campus
Some key normal distribution probabilities
• For X ~N (μ, σ2)
19
Quantitative Methods
Lecture-8
BITS Pilani
Pilani Campus
1
BITS Pilani
Pilani Campus
✓ Previous Sessions
√ Discreet Probability Distributions
√ Probability mass function (PMF) and Cumulative probability distribution
√ Continuous and Normal Distributions
√ Probability Density Function (PDF) and Cumulative Distribution Function (CDF)
√ Probabilities as area under the PDF curve (region of interest).
√ Use of cumulative Z tables to calculate normal probabilities
√ One sided Z table (+Ve or –Ve values) is sufficient as the distribution is symmetric
➢ Today
➢ Survey errors
➢ Sampling distributions
3
BITS Pilani, Pilani Campus
Setting the context for the next few sessions
4
BITS Pilani, Pilani Campus
BITS Pilani
Pilani Campus
Census
▪ Entire population (population, tiger, agriculture,
health facilities).
Sampling 43, 54,
▪ A portion of the population. 38, 22
▪ Quality, voting, blood, soil, customer surveys, voice,
interviews, ….
Population Sample
Why samples?
▪ Quicker.
▪ Cheaper.
N, N, Y,
▪ May not participate/Not available.
N Y, N,
▪ When tests are destructive.
Y, Y
▪ Scientifically chosen samples can give very good
accuracy about the properties of the population.
6
BITS Pilani, Pilani Campus
Sampling methods
7
BITS Pilani, Pilani Campus
Objective of the sampling
➢ Main objective
➢ Estimating properties of the population
➢ Sample properties are a way to estimate the parameters of the
population
➢ Mean
➢ What is the mean life of a battery from brand-A?
➢ Proportions
➢ What proportion of the population prefers my product over the competitor’s?
➢ Only a sample drawn by probability sampling can be used for
estimating population parameters
8
BITS Pilani, Pilani Campus
Probability sampling
Cluster sampling
heterogeneous cluster
Systematic sampling
Every nth item/bottle
• Nonresponse error
• Some from the chosen sample may not respond
• Measurement error
• Approximate scales
• Psychological scales give approximate values
• Attitudes, strength of beliefs etc.
• Bad or leading question
• Do you like color and taste of the candy?
• Yes / No
• Sampling error
• You get a different sample each time you draw a sample
• Sample to sample random differences
BITS Pilani, Pilani Campus
BITS Pilani
Pilani Campus
Sampling Distributions
(Ch 7 Business Statistics, Levine et al.)
Sampling Distributions
Sampling
Distributions
Sampling Sampling
Distribution of the Distribution of the
Mean Proportion
12
BITS Pilani, Pilani Campus
Population parameter(s) and Sample statistic(s)
13
BITS Pilani, Pilani Campus
Population >> Samples >> Sampling Distribution
14
BITS Pilani, Pilani Campus
Population >> Samples >> Sampling Distribution
𝑋1, S1
X~ N(µ,σ2) 𝑋ത ~ N(µ,σ𝑋ത 2)
𝑋2, S2
X values 𝑋ത values
(Age, height, weight etc.)
𝑋𝑚, Sm
p1 Mean = π
π(1 − π)
Population proportion: π σ𝑃 =
p2 𝑛
Size: N
Sampling Distribution
Samples of size n,
of the Proportion
with proportions p1, p2, …, pm
Random Variable: 𝑝
Assuming: nπ and n(1- π)>=5
16
BITS Pilani, Pilani Campus
Sampling Distribution of the Mean
17
BITS Pilani, Pilani Campus
Sampling Distribution of the Mean
𝑋1, S1 σ
X~ N(µ,σ2) 𝑋ത ~ N(µ,σ𝑋ത 2) σ𝑋ത =
𝑛
𝑋2, S2
X values 𝑋ത values
(Age, height, weight etc.)
𝑋𝑚, Sm
Sampling
Distributions
Sampling Sampling
Distribution of the Distribution of the
Mean Proportion
19
BITS Pilani, Pilani Campus
Sampling from a normally distribution population
20
BITS Pilani, Pilani Campus
Z value for Sampling Distribution of the Mean
𝑋ത −µ
• Z=
σ𝑋
ഥ
𝑋ത −µ
• Z= σ
𝑛
σ
• 𝑋ത = µ + Z σ𝑋ത = µ + Z
𝑛
21
BITS Pilani, Pilani Campus
Example
• A Coconut water bottle filling machine is tuned for normally distributed
fill quantity, with µ of1000ml and σ of 100ml
• For quality check, a sample of 100 bottles is drawn, and sample mean is
calculated. Machine must be stopped and retuned if the sample mean is
outside center 95% of the sampling distribution of the Mean (lies in the left
or right tails beyond this range ) • Which cumulative
probability entry will you
• You found the sample mean to be 980ml, should you halt the machine?
see in the Z table?
• .025 or .975
• µ = 1000, σ = 100, n=100 What is your lower halt cut-off in ml?
σ
• Standard error of the Mean: σ𝑋ത ? (= )
𝑛 𝑋ത − µ
• 10 𝑍=
σ𝑋ത
• Sampling distribution of the Mean ~ N (µ = 1000, σ𝑋ത = 10) 𝑋ത −1000
-1.96 =
10
• Value of interest, Z value? ത
𝑋 = -19.6 + 1000 = 980.4ml
• 980, -2
What is the upper cut-off in ml?
• Should you halt the process? 22
BITS Pilani, Pilani Campus
Sampling Distributions
Sampling
Distributions
Sampling Sampling
Distribution of the Distribution of the
Mean Proportion
23
BITS Pilani, Pilani Campus
Sampling from a populations not normally distributed
24
BITS Pilani, Pilani Campus
Central Limit Theorem: Empirical verification
Sampling
Distributions
Sampling Sampling
Distribution of the Distribution of the
Mean Proportion
26
BITS Pilani, Pilani Campus
Sampling Distribution of the Proportion
• Categorical variables
• Female %, % prefer Trump etc.
• If population proportion is π
• Mean of “Proportions” of all the possible samples is also π
𝑋:𝑁𝑢𝑚𝑏𝑒𝑟𝑠 𝑤𝑖𝑡ℎ 𝑐ℎ𝑎𝑟𝑎𝑡𝑒𝑟𝑖𝑠𝑡𝑖𝑐𝑠 𝑜𝑓 𝑖𝑛𝑡𝑒𝑟𝑒𝑠𝑡
• Sample proportion: p =
n:Sample size
• Standard error of the Proportion:
π(1−π)
• σ𝑝 =
𝑛
• n: 𝑠𝑎𝑚𝑝𝑙𝑒 𝑠𝑖𝑧𝑒
27
BITS Pilani, Pilani Campus
Sampling Distribution of the Proportion
π(1−π)
• σ𝑝 =
𝑛
• n: 𝑠𝑎𝑚𝑝𝑙𝑒 𝑠𝑖𝑧𝑒
28
BITS Pilani, Pilani Campus
Sampling Distribution of the Proportion
p1 Mean = π
π(1 − π)
Population proportion: π σ𝑃 =
p2 𝑛
Size: N
Sampling Distribution
Samples of size n,
of the Proportion
with proportions p1, p2, …, pm
Random Variable: 𝑝
Assuming: nπ and n(1- π)>=5
29
BITS Pilani, Pilani Campus
Z value for Sampling Distribution of the Proportion
30
BITS Pilani, Pilani Campus
A question from the book (7.14 p 262)
• A research study found that with 80% of women say that having a flexible work
schedule is either very important or extremely important to their career success.
• Suppose you select a sample of 100 working women.
• What is the probability that in the sample fewer than 85% say that having a
flexible work schedule is either very important or extremely important to their
career success?
• P (p<=0.85)
• What is the probability that in the sample between 75% and 85% say that having
a flexible work schedule is either very important?
• P(0.75<=p<=.85)
p−π p−π
• Calculate Z values: => Z = and use Z table to find the answers
σ𝑝 π(1−π)
𝑛
31
BITS Pilani, Pilani Campus
Exam related questions
• Syllabus
• Descriptive Statistics, Statistical charts, measures of central tendency and dispersion
• Data scales, Probability, Bayes Theorem
• Probability distributions
• Including discrete distributions and continuous distributions, and the mean and variance of a probability
distribution.
• Up-to session-7 (Normal distribution)
• Calculator is allowed
• Onscreen version or your own
• One sided Z cumulative probability table will be provided
• You can type your answers or upload handwritten answers after scanning
• All the best!
32
BITS Pilani, Pilani Campus
Q&A
33
Quantitative Methods
Lecture-9
BITS Pilani
Pilani Campus
1
BITS Pilani
Pilani Campus
✓ Previous Sessions
√ Probability Distributions
√ Sampling Distributions of the mean and the proportion
➢ Today
➢ Confidence Interval Estimation
3
BITS Pilani, Pilani Campus
Sampling distributions
• Deductive reasoning
• Deriving specific conclusions from general principles or understanding
• Taking something as true and making deductions based on that
• So far we have been assuming that population parameter (mean or proportion) is known
• We have been trying to find the interval around the (known) population mean
• Top 5%, bottom 5%, within certain distance from the (known) mean (central 95% etc.)
• Inductive reasoning
• Deriving broader generalizations from something specific
• Generally all you know is the sample statistics from just one sample (sample mean, or proportion etc.)
• We need to draw interference about the population parameters from the sample statistics
• From 𝑋ത to µ or From p to π
• Example:
• From an everyday sampling process you find that 5% of the products in the sample are defective
• What conclusions can you draw about the proportion of faulty products produced today?
5
BITS Pilani, Pilani Campus
Type of estimates
• Point estimate
• One estimate of sample mean or proportion from the sample
• 𝑋ത or p as one point estimate of µ or π
• Interval estimate
• An interval is constructed in such a way, that you know the probability of population parameter to
be in that interval
• Example:
• Given the sample mean 𝑋ത and sample standard deviation S,
“You would like to say with 95% confidence that the population mean lies in an interval between values
L (lower limit) and H (higher limit)”
6
BITS Pilani, Pilani Campus
Confidence interval of the Mean
• When population standard deviation (σ) is known
• Drawing inference from the sampling distribution of the Mean and Z distribution tables
7
BITS Pilani, Pilani Campus
Confidence interval of the Mean: σ known
• If we know µ we can calculate probability that 𝑋ത will lie is a given interval (previous session)
• Min 𝑋ത for top 5%
• Max 𝑋ത for bottom 5% or
• 𝑋ത does not lie in the top or bottom 2.5% tails (within 95% around the mean)
• Now given 𝑋ത 𝑎𝑛𝑑 σ, you want to find the 95% probability range for µ
8
BITS Pilani, Pilani Campus
Confidence interval of the mean when σ is known (1/4)
𝑋ത
-1.96 +1.96 Z
Sampling distribution of the Mean 9
BITS Pilani, Pilani Campus
Confidence interval of the means when σ is known (2/4)
ത and 𝑋5?
• What is special about 𝑋4
ത and 𝑋5
• For all the sample means, that lie between 𝑋4 𝑋ത
σ
• ഥ𝑋 ± intervals would contain µ
𝑛
11
BITS Pilani, Pilani Campus
Confidence interval of the Mean when σ is known (4/4)
12
BITS Pilani, Pilani Campus
Most commonly used confidence intervals
• 95% confidence interval: 𝑋ത ± 1.96
σ
𝑛
13
• [10.9941, 11.0019]
• You can say with 95% confidence that the population mean
• Lies between 10.9941 and 11.0019 14
BITS Pilani, Pilani Campus
Confidence interval of the mean when σ is unknown
15
BITS Pilani, Pilani Campus
Confidence interval of the mean when σ is unknown
• When Sample standard deviation is used as an estimate for population standard deviation,
• In place of Z distribution we use student’s-t distribution
• There is one student t-distribution for each sample size (n) or degrees of freedom (n-1)
• t-distribution approaches 'Z distribution as ‘n’ goes up
16
BITS Pilani, Pilani Campus
t-distribution
• Z-Statistic of the sampling distribution of the Mean
𝑋ത −µ
• 𝑍 = σ , σ: Population standard deviation
ൗ 𝑛
19
BITS Pilani, Pilani Campus
Testing normality assumption
t-distribution assumes that variable X is normally distributed
• However, for large sample sizes, and
• When population is not very skewed
• You can still use t-tables for non-normal populations
20
BITS Pilani, Pilani Campus
Testing normality assumption
21
BITS Pilani, Pilani Campus
Q-Q plot : Quantile-Quantile plot
Q-Q plot
• Z values of the X-Axis
• Corresponding values (data sequences) on y-axis)
• Ideally the plot should be a straight line
• Significant deviation from the straight line represent
non-normality
(Refer to page 239 Levine et. al)
22
BITS Pilani, Pilani Campus
Confidence interval of the Proportion
• Confidence Interval for the Proportion
• Probability that the confidence interval would contain the population proportion
• Confidence Interval for the proportion
𝒑(𝟏−𝒑)
• 𝒑 ± 𝒁𝜶/𝟐 𝝈𝒑 = 𝒑 ± 𝒁𝜶/𝟐 𝒏
𝑝(1−𝑝)
• Proportions upper and lower limit estimates 𝑝 ± 𝑍𝛼/2 𝑛
27
BITS Pilani, Pilani Campus
Sample size estimates for the Mean sampling error
o 𝑛 = 𝑍𝛼/2 2 𝜎 2 /𝑒 2
o Example:
o Historically marks of the students in Quant course have ranged from 0 to 100
o You want an interval estimate of the population mean marks with 0.05 significance or 95%
confidence. However, for results to be meaningful, you want the confidence interval width
of 10 marks only. What is the sample size that you need for the study
o 𝛼?
o e?
o 𝑍𝛼/2 = 1.96
o n = (1.96*(100/6)/5)2 = 42.68 = ~43
28
BITS Pilani, Pilani Campus
Sample size estimates for the Proportion sampling errors
𝜋(1−𝜋)
– Sampling error (e) = 𝑍𝛼/2
𝑛
– 𝑛 = 𝑍𝛼 2 𝜋(1 − 𝜋)/𝑒 2
2
30
Quantitative Methods
Lecture-10
BITS Pilani
Pilani Campus
1
BITS Pilani
Pilani Campus
✓ Previous Sessions
√ Probability Distributions
√ Confidence Interval Estimation
➢ Today
➢ Hypotheses testing
3
BITS Pilani, Pilani Campus
Previous Class: Confidence Interval
4
BITS Pilani, Pilani Campus
Hypothesis testing (1/3)
As a business manager you my want to test if the assumed value reflects the reality
• Mean bottle fill volume is 1000ml
• Mean component diameter is .2mm
• Defect rate of the manufacturing process is <1%
• A new drug is more effective than the old drug
• The weight reduction plan indeed reduces the weight (Wtafter < Wtbefore)
Remember you are interested in the population parameters and not the sample statistic
• Sample statistic (mean, sd) are just a vehicle to infer the population parameters (mean, proportion)
5
BITS Pilani, Pilani Campus
Hypothesis testing (2/3)
Hypothesis consists of two statements
• Null Hypothesis (H0)
• Alternate Hypothesis (H1)
• Together they make the entire set of possibilities
Examples
• Mean bottle fill volume: H0: μ = 1000ml and H1: μ ≠ 1000ml
• Population error rate: H0: π ≤ 1% and H1 : π >1%
How to decide your null hypothesis
• Your alternate hypothesis should be set to enable a business decision (Should I stop my
machine for tuning)
• Null hypothesis should be set to be rejected (The new drug is not effective).
• Your assumption is set as an alternate hypothesis (The new drug is effective)
6
BITS Pilani, Pilani Campus
Hypothesis testing (3/3)
Null is never accepted (You only fail to reject it)!
• H0: All Swans are white and H1: All Swans are not white
• If your sample has a million white swans. Can you accept the null hypothesis?
• You can only say “You do not have sufficient evidence to reject it”
• It may be that you do not have sufficient sample size
7
BITS Pilani, Pilani Campus
Critical Value and test statistic
• We use statistical distribution of the sample statistic for testing the H0
hypothesis (H0: μ = 1000ml)
• What is sample statistic? 𝑋2
• What is the distribution of the sample statistic? 𝑋1
• If the sample statistic is sufficiently close to null hypothesis value,
you cannot reject it (𝑋2).
• But if it too far, you may have a reason to reject it (𝑋1).
• How far is too far?
µ ± 𝑍α/2 σ/ 𝑛
• Region of rejection based on critical values of Z-distribution or t-
Distribution of the sample statistic.
• µ ± 𝑍α/2 σ/ 𝑛 or µ ± 𝑡α/2 S/ 𝑛
• If your sample mean is 𝑋1, will you reject the null hypothesis?
• If it is 𝑋2, will you reject the null hypothesis?
8
BITS Pilani, Pilani Campus
Critical Value Approach: Two-Tail Test
• When hypothesis is of the type H0: μ = 1000ml and H1: μ ≠ 1000ml
• You would like to reject the null hypothesis if the sample mean fill
volume is too high, or it is too low
• Area of rejection lies on both the sides of the sampling distribution
• The rejection region is divided into two parts (both left and right tail
containing α/2 area)
Example
• For 95% confidence or .05 significance
• Each tail (right and left rejection regions) will have 0.025 (2.5%) values
under it.
• Critical Z values will be -1.96 and +1.96
• If your sample statistic falls in the region of rejection, you reject the null
9
BITS Pilani, Pilani Campus
Decision risks: Type-I error and Type-II errors
Type-I error H0
• When your null hypothesis is true
• If you get a sample mean 𝑋1 , would you reject null? 𝑋2
10
BITS Pilani, Pilani Campus
Type-II error
• Probability of not rejecting the null hypothesis when it is indeed false is called type-II
H0
error (β).
Actual μ1
• β depends on the actual difference between the population parameter and
hypothesized value.
𝑋1
• (1- β) is called the power of the statistical test.
• Probability of not making Type-II error.
• The probability of rejecting null hypothesis when it is false.
• Can’t be controlled by the choice of α.
• When you reduce α, you increase β. µ ± 𝑍α/2 σ/ 𝑛
• Can be reduced by increasing sample size (why?)
• Increase in n, reduces the standard error. Makes the sampling distribution narrower.
• Makes the area of Non-Rejection narrower
• Which error should you focus on?
• Use your business situation to decide. One can be reduced at the expense of the
other 11
BITS Pilani, Pilani Campus
Hypothesis testing steps
1. State the null and the alternate hypotheses
2. Decide alpha and n, based on the costs associated to type-I and type-II errors
3. Collect the sample
4. Decide the appropriate test statistic and the sampling distribution
1. Z or t-statistic
5. Calculate the critical values and areas of rejection and non-rejection
6. Find the sample statistic
7. Decide whether the sample statistic falls in the area of rejection/non-rejection
12
BITS Pilani, Pilani Campus
When to use which distribution for estimation
13
BITS Pilani, Pilani Campus
Example 9.3 (p. 314 Levine et al.)
• The business problem: Is population mean waiting time to place an order 4.5 minutes?
• The population is normally distributed, with a population standard deviation of 1.2 minutes.
• A sample of 25 orders during a one-hour period shows the sample mean to be 5.1 minutes.
• Determine whether there is evidence at the 0.05 level of significance to support the assumption?
Step 1: State the null and the alternate hypotheses
• H0: μ = 4.5 minutes and H1: μ ≠ 4.5 minutes 4.5
Step 2: Decide alpha and n 𝑋1 = 5.1
• α = 0.05, n = 25 Z=2.5
Step 3: Collect the sample (we already have it).
Step 4: Decide the appropriate test statistic and the sampling distribution (Z or t?)
Step 5: Calculate the critical values and areas of rejection and non-rejection
Critical Z? Critical Area? (µ±𝑍(α/2)σ/√𝑛)
4.5 ± 1.96*1.2/5 => Area of acceptance is between 4.03 and 4.97
4.03 𝑡𝑜 4.97
Step 6: Calculate sample statistic (𝑿ഥ ) : 5.1 Z=-1.96 Z=+1.96
The ZSTAT of the sample statistic, if the null was true? (5.1 – 4.5) / (1.2/5 ) = +2.5
Step 7: Make the decision! (Should we reject the null hypothesis?) 14
BITS Pilani, Pilani Campus
p-value approach to Hypothesis testing
1. p-value is the observed value of significance
2. p-value is the probability of getting the test statistic equal or more extreme than
the currently calculated value if the null hypothesis was correct
3. Test statistic: (𝑋1) =5.1, Z=2.5
4. p=?
5. Total area under the tails beyond Z>=2.5 and Z<=-2.5
6. p = (1-0.9938)*2 = 0.0124 Z=-2.5 Z=+2.5
7. Chosen level of significance?
8. 0.05
9. In other words, you would not have rejected the null hypothesis if the
significance was 0.0124
10. Reject the null if p<= α
11. H0 must go if p-value is less than or equal to the chosen level of significance
15
BITS Pilani, Pilani Campus
Comparison of Confidence interval and Hypothesis testing approach
16
BITS Pilani, Pilani Campus
Hypothesis testing when σ is unknown
• When population standard deviation (σ) is known
• Drawing inference from the sampling distribution of the Mean and Z distribution tables
• All the steps remain the same as Z statistic example. Only change is that we now use t-statistic to
determine area of acceptance, rejection or p-value
• Test of normality is required for small samples
17
BITS Pilani, Pilani Campus
Critical Value Approach: One-Tail Test
• When you are interested in only one side of the distribution
• Example: You want to test whether the proportion of students
supporting a schedule change is more than 50%.
• When hypothesis is of the type H0: π ≤ .5 and H1: π > .5
• Now the region of rejection lies entirely in the right tail
• The rejection region is now right tail containing α area
Example
• For 95% confidence or .05 significance
• Right tail rejection regions will have 5% of the values under it.
• Critical Z values will be +1.645 (or ~+1.65)
• All other steps remain the same
• Find the Z value of the sample statistic
• Analyze whether it lies in the rejection region or not
18
BITS Pilani, Pilani Campus
Z test of hypothesis for proportions
• We use Z-test for the proportions
𝜋(𝟏−𝜋)
• ZSTAT = (𝑝 − 𝜋)/
𝒏
𝑁𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑖𝑡𝑒𝑚𝑠 ℎ𝑎𝑣𝑖𝑛𝑔 𝑡ℎ𝑒 𝑐ℎ𝑎𝑟𝑎𝑐𝑡𝑒𝑟𝑖𝑠𝑡𝑖𝑐 𝑜𝑓 𝑖𝑛𝑡𝑒𝑟𝑒𝑠𝑡 (𝑋)
• Sample proportion = p =
𝑇𝑜𝑡𝑎𝑙 𝑛𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑖𝑡𝑒𝑚𝑠 (𝑛)
• ZSTAT follows approximately normal distribution subject to the assumption that both X and n-X are greater
than 5
• Hypothesis testing by either critical value approach or p-value approach
19
BITS Pilani, Pilani Campus
Example: 9.4 page 333 Levin et al. (One tail proportions)
• McDonald’s had a drive through service, which filled 90.9% of its drive-through orders correctly.
• After quality improvement efforts, a sample of 400 orders using the new process indicated that 378
orders were filled correctly.
• At the 0.01 level of significance, can you conclude that the new process has increased the proportion of
orders filled correctly?
• Two tailed of one tailed test?
• Null hypothesis: H0? And the alternate hypothesis: H1?
• H0: π ≤ 90.9 and H1: π > 90.9
• Level of significance: α? Critical Z value?
• α =.01, Z critical = ~2.33
• Sample statistic (sample proportion p?) and corresponding ZSTAT value?
(𝑝−𝜋) .𝟗𝟎𝟗(𝟏−.909)
• Sample p = 378/400 = 0.945, ZSTAT = = (.945 − .909)/ 𝟒𝟎𝟎
= 2.503
𝜋 𝟏−𝜋
𝒏
• You want to test that the new process has a service time mean of less than
188.83 seconds.
• You collect the data by selecting a sample of n = 25 stores.
• you find that the sample mean service time
• at the drive-through equals 170.8 seconds and the sample standard
deviation equals is 21.3 seconds
• You decide to use α = 0.05. Population σ is unknown.
• Two tailed or one tailed test? Null hypothesis: H0? And H1?
• H0: μ ≥ 188.83 and H1: μ < 188.83
• Level of significance: α? Degrees of freedom? Critical t value?
• α =.05, df = 24, t-critical = -1.7109
• tSTAT = (170.8 – 188.83)/21.3/ 𝟐𝟓 = -4.23
• p-value: 0.0001, from XL Formula: T.DIST.RT(t-stat, df)
• tSTAT is in the region of rejection, null hypothesis must be rejected
• p-value is less than α, null hypothesis must be rejected
21
BITS Pilani, Pilani Campus
Q&A
22
Quantitative Methods
Lecture-11
BITS Pilani
Pilani Campus
1
BITS Pilani
Pilani Campus
✓ Previous Sessions
√ Probability Distributions
√ Confidence Interval Estimation
√ Hypothesis testing
➢ Today
➢ Two Sample Tests and ANOVA
3
BITS Pilani, Pilani Campus
Concept Alert! Inherent randomness
Population 0.18
0.16
• Population distributions can be discrete (binomial etc.) or continuous (normal etc.). 0.1
0.08
0.06
0.04
0.02
A fair dice population 0
1 2 3 4 5 6
𝜀
• Random Var. X: The number that shows up on the top.
• µ ~3.5, σ ~ 1.71.
• You want to find out the possible reason of the difference between µ & 𝑋𝑖 0
1 2 3 4 5 6
n=100, Sampling
distribution of
𝑋. 𝜎𝑋ത = 0.171
6
BITS Pilani, Pilani Campus
Concept Alert! Same or different populations?
0.18
Questions we generally would be answering 0.16
• We would have some proven sampling distribution for our sample statistic
0.14
0.12
0.1
• We would ask: Is the sample statistic within the region of “non-rejection”. 0.08
0.06
• We assume that our sample statistic can be anywhere in the region of non- 0.04
0.02
rejection because of the inherent randomness. 0
1 2 3 4 5 6
• Are the conversion rates the same, for the “buy-now button” of 5 different colors
on your website?
• Is stock portfolio-A riskier (more variance) than the portfolio-B?
X1 ~ N(µ1,σ2) 𝑋1 - 𝑋2 ~ N(µ1-µ2,σ𝑋1 − 𝑋2 2)
X2 ~ N(µ2,σ2) 𝑋1 - 𝑋2 values
Sampling Distribution of
Differences in Means
Populations
11
BITS Pilani, Pilani Campus
Difference in Means: Sampling Distribution
1 1
𝑆𝑡𝑎𝑛𝑑𝑎𝑟𝑑 𝑒𝑟𝑟𝑜𝑟: σ𝑋1 − 𝑋22 = 𝑆𝑝2 (𝑛1 + 𝑛2)
𝑋1 - 𝑋2 values
• Why pooled?
• We have two estimates, pooling them gives an estimate from a larger sample
2 (n1 −1)∗𝑆1 +(n2 −1)∗𝑆2
2 2
• 𝑆𝑝 =
n1 +n2−2
• Confidence interval
1 1
• 𝑋1 − 𝑋2 ± 𝑡𝛼 𝑆𝑝2 (𝑛1 + 𝑛2)
2
• 𝑡𝛼 : Upper tail critical value, with 𝛼 significance, of t distribution with n1+n2 -2 degrees
2
𝛼
of freedom (critical value for upper tail area of )
2
12
BITS Pilani, Pilani Campus
Hypothesis testing:
Independent populations: Comparison of means
• Are population means same, one greater or lower?
• Two tailed: H0: μ1 = μ2 => μ1 - μ2 = 0
• One tail: H0: μ1 ≥ μ2 => μ1 - μ2 ≥ 0
• Test statistic: 𝑋1 − 𝑋2 ?
• -22
• n1 + n2 -2 = 18
14
BITS Pilani, Pilani Campus
Example
• Test statistic: 𝑋1 − 𝑋2 : -22
• Standard error?
1 1
• Standard error: 𝑆𝑝2 ( + ) = 7.13
𝑛1 𝑛2
• Degrees of freedom: 18
15
BITS Pilani, Pilani Campus
Comparing the means of two related populations
When two populations (for sample 1 and sample 2) are not independent
• Outcomes of the first population are not independent of the outcomes of the second population
16
BITS Pilani, Pilani Campus
Comparing the means of two related populations
When two populations (for sample 1 and sample 2) are not independent
• Are store-A book prices more than store-B prices?
• If the sample “A” predominantly consists of very expensive titles and B contained predominantly inexpensive
paperbacks.
• Better way may be to take the prices for similar books for comparison.
• Another way is to pair the measurement units on some characteristic (paperbacks and hardbound etc)
Store-A Store-B Difference
• By using related populations, we reduce overall variance by reducing the “unit level difference” between the two
samples.
• Lower variance reduces the β-error (probability of not rejecting a false null hypothesis).
18
BITS Pilani, Pilani Campus
BITS Pilani
Pilani Campus
Two tailed:
H0: π1=π2
π1 – π2 = 0
One tail:
H0: π1 ≥ π2
π1 – π2 ≥ 0
Standard error:
1 1
𝑆𝑡𝑎𝑛𝑑𝑎𝑟𝑑 𝑒𝑟𝑟𝑜𝑟: σ𝑝1− 𝑝2 = 𝑝(1
ҧ − 𝑝)ҧ ( + )
𝑛1 𝑛2
𝑋1+𝑋2 𝑋1 𝑋2
• 𝑝ҧ = , p1 = , p2 =
𝑛1+𝑛2 𝑛1 𝑛2
• Confidence interval
1 1
• (𝑝1− 𝑝2) ± 𝑍𝛼/2 𝑝(1
ҧ − 𝑝)ҧ ( + )
𝑛1 𝑛2
All the steps are similar to the previous example. The only difference is that we now use a Z-test instead of a t-test.
21
BITS Pilani, Pilani Campus
BITS Pilani
Pilani Campus
• F-Test
24
BITS Pilani, Pilani Campus
Equality of variances, two independent populations
F-Test
FSTAT = S12 / S22
350.68/157.33 = 2.23
Numerator & Denominator degrees of freedom:
9
Fcritical ? (From F-Table for .05 significance)
4.03
Should we reject the null?
FSTAT < Fcritical
p-value = 0.25 ( p>α)
We do not have sufficient evidence to reject the null hypothesis.
We can assume that the variances are equal.
25
BITS Pilani, Pilani Campus
BITS Pilani
Pilani Campus
One-way ANOVA:
• One factor
27
BITS Pilani, Pilani Campus
ANOVA: Analysis of variance
It’s a two Step Process
• H1: Not all means are same or at least one mean is different from others
• If null is rejected, find out which means are different from others
• Second step is not in the syllabus, but we may review it if time permits.
28
BITS Pilani, Pilani Campus
ANOVA: Analysis of variance
• Assuming you randomly select samples from “c” populations,
which are normally distributed with equal variances Loc 1 Loc 2 Loc3 Loc4
29
BITS Pilani, Pilani Campus
ANOVA: Analysis of variance
We partition the total variation into two parts.
Loc 1 Loc 2 Loc3 Loc4
• Within group variation: Due to random variation or the sampling error (SSW).
30.06 32.22 30.78 30.33
• Differences are due to the sampling error or are random (Xi = µ + εi).
29.96 31.47 30.91 30.29
• Among groups variation: Due to variation between the groups (SSA)
30.19 32.13 30.79 30.25
30
BITS Pilani, Pilani Campus
ANOVA: Total Sum of Squares
Calculating the total sum of squares (Total variation): SST
• Under null hypothesis, all the group means are same, so they all can just be Loc 1 Loc 2 Loc3 Loc4
• We calculate grand mean 𝑋ധ and then calculate sum of square deviation from 29.96 31.47 30.91 30.29
• n = Total sample size (sum of all group sample sizes) SD 0.164985 0.335306 0.142548 0.12522
• n-1
• Associated degrees of freedom with the SSA : c-1 29.74 32.29 31.13 30.55
32
BITS Pilani, Pilani Campus
Within Group Variations
Calculating within groups sum of squares : SSW Loc 1 Loc 2 Loc3 Loc4
• Sum of squares of individual value from their group means 30.06 32.22 30.78 30.33
𝑛𝑖
• SSW = σ𝑐𝑗=1 σ𝑖=1(𝑋𝑖𝑗 −𝑋ഥ𝑗 )2
29.96 31.47 30.91 30.29
• Within group Variance for ANOVA Mean 29.982 31.994 30.912 30.334
• Mean Squares Total: MSA = SSA / (n-c)
SD 0.164985 0.335306 0.142548 0.12522
33
BITS Pilani, Pilani Campus
Using F-Test for One Way ANOVA s
• We used F-Test to test the equality of two variances
• Under the null hypothesis all groups belong to same population.
• Given this, grouped variance estimate (MSW) and within variance estimate (MSW) should be equal.
𝑀𝑆𝐴
• One-Way ANOVA test statistic: FSTAT =
𝑀𝑆𝑊
• Follows F-Distribution with, c-1 numerator degrees of freedom, and n-c denominator degrees of freedom
34
BITS Pilani, Pilani Campus
Using F-Test for One Way ANOVA s
• Reject null if FSTAT > Fα
• Rejection of null hypothesis only means that not all means are equal.
35
BITS Pilani, Pilani Campus
ANOVA Table
• In Questions
• You may have to create the ANOVA Table, or
• You may be given an ANOVA Table to interpret
• Normality
• Group populations are normally distributed
• Test is relatively robust and works well for approximately normal populations
• Homogeneity of variance
• Population variances are same
• For same groups sizes, the test is quite robust against small variations
• Levine test (F-test on absolute deviations from group medians can be used) to test of equal variances
37
BITS Pilani, Pilani Campus
When to use which test
38
BITS Pilani, Pilani Campus
Multiple Mean Comparisons
• Finding out if the means are different is the first step
• If the null is rejected. The second step is to find out, which of the means are different.
• Instead of doing individual paired t-tests (for difference in means) for all the possible pair of means. We can run a joint
multiple Tukey-Kramer Procedure.
• It has two steps
• Compute the absolute mean differences 𝑋ഥ𝑗 − 𝑋ഥ𝑖 𝑤ℎ𝑒𝑟𝑒 𝑖 𝑎𝑛𝑑 𝑗 𝑟𝑒𝑓𝑒𝑟 𝑡𝑜 𝑑𝑖𝑓𝑓𝑒𝑟𝑛𝑡 𝑔𝑟𝑜𝑢𝑝𝑠 (𝑖 ≠ 𝑗)
• How many pairs would have in c groups?
• c(c-1)/2 (why?)
• Compute critical range for the Tukey Kramer procedure for each pair of sample sizes
• Declare a group pair to be different if the absolute mean difference is more than the critical range 39
BITS Pilani, Pilani Campus
Multiple Mean Comparisons – Stores example
• Qα is 4.05
• Pair-wise ranges
40
BITS Pilani, Pilani Campus
Q&A
41
Quantitative Methods
Lecture-12
BITS Pilani
Pilani Campus
1
BITS Pilani
Pilani Campus
Chi-square tests
(Ch 11 Business Statistics, Levine et al.)
Today’s session
➢ Chi-square tests.
➢ Goodness of fit.
➢ Simultaneously testing the difference between of two or more
proportions.
➢ Test of independence.
3
BITS Pilani, Pilani Campus
The Concept behind chi-square test
• A population “X” has certain proportions of defined attributes.
• Say, 50% of humans in the population are Females, and 50% are Male.
• 50% each.
• What are the expected frequencies of Males and Females in this sample?
• 25 each. Why?
• However, the difference between observed and expected frequencies should be close to zero.
• You can assume that the samples are from the same population.
• If you find that the differences are too large, you may conclude that they are not from the
expected population.
(𝑓𝑜 −𝑓𝑒 )2
• 𝑇𝑒𝑠𝑡 𝑠𝑡𝑎𝑡𝑖𝑠𝑡𝑖𝑐: χ2 𝑆𝑇𝐴𝑇 (Chi-square statistic) = σ𝐴𝑙𝑙 𝑐𝑒𝑙𝑙𝑠 𝑓𝑒
• 𝒇𝒐 : 𝑂𝑏𝑠𝑒𝑟𝑣𝑒𝑑 𝑓𝑟𝑒𝑞𝑢𝑒𝑛𝑐𝑦, in the sample 𝒇𝒆 : 𝐸𝑥𝑝𝑒𝑐𝑡𝑒𝑑 𝑓𝑟𝑒𝑞𝑢𝑒𝑛𝑐𝑦 𝑖𝑓 𝑡ℎ𝑒 𝑝𝑟𝑜𝑝𝑜𝑟𝑡𝑖𝑜𝑛𝑠 𝑤𝑒𝑟𝑒 𝑠𝑎𝑚𝑒.
• If null hypothesis of no difference is correct, 𝝌𝟐 𝑺𝑻𝑨𝑻 follows chi-square distribution with df degrees of freedom.
• no_of_estimated_parameters: In normal distribution you may have to estimate the mean and the
standard deviation
(𝒇𝒐 −𝒇𝒆 )𝟐
Option Observed Expected Expected Expected 𝝌𝟐 𝑺𝑻𝑨𝑻 = σ𝑨𝒍𝒍 𝒄𝒆𝒍𝒍𝒔
𝒇𝒆
Frequency Frequency Frequency Frequency
(fo) (fe) (fo-fe)^2 (fo-fe)^2/fe 𝝌𝟐 𝑺𝑻𝑨𝑻 = 2.6
A 15 20 25 1.25
B 19 20 1 0.05
C 25 20 25 1.25
D 21 20 1 0.05
Total 80 80 2.6
Degrees of freedom:
Number of values – 1 – no_of_estimated_parameters
• Observed frequency is given. What are the expected proportions? (𝒇𝒐 −𝒇𝒆 )𝟐
𝝌𝟐 𝑺𝑻𝑨𝑻 = σ𝑨𝒍𝒍 𝒄𝒆𝒍𝒍𝒔
𝒇𝒆
• What are the expected frequencies: 100 each (why?)
• Calculate sample chi-square statistic and compare it with the critical value.
• 7-1-2 = 4 (why?)
• Calculate the test statistic, critical value and test the hypothesis. (How?).
Rject H0 𝐢𝐟 𝝌𝟐 𝑺𝑻𝑨𝑻 > 𝝌𝟐 𝜶
• You want to test if the proportion of customers willing to buy again is same for both the stores.
• H0: π1=π2
• H1: π1≠π2
(𝑓𝑜 −𝑓𝑒 )2
• 𝑇𝑒𝑠𝑡 𝑠𝑡𝑎𝑡𝑖𝑠𝑡𝑖𝑐: χ2 𝑆𝑇𝐴𝑇 (Chi-square statistic) = σ𝐴𝑙𝑙 𝑐𝑒𝑙𝑙𝑠
𝑓𝑒
• We need to answer two questions.
• Degrees of freedom? 1 (Why?)
• How to calculate 𝒇𝒆 : 𝐸𝑥𝑝𝑒𝑐𝑡𝑒𝑑 𝑓𝑟𝑒𝑞𝑢𝑒𝑛𝑐𝑦 𝑖𝑓 𝑡ℎ𝑒 𝑝𝑟𝑜𝑝𝑜𝑟𝑡𝑖𝑜𝑛𝑠 𝑤𝑒𝑟𝑒 𝑠𝑎𝑚𝑒 at both the stores.
• How to calculate 𝑓𝑒 ?
• Under null hypothesis, proportion of items of interest would be same.
• We can take proportion from store-1, store-2, or from the total. Which estimate is better?
𝑋
• Overall estimated proportion of the item of interest: 𝑝ҧ = ;
𝑛
• X: Total number of items of interest, n: Total sample size.
• 𝑓𝑒 = column_total* 𝑝,ҧ for items of interest, and column_total* (1 − 𝑝) for the items of not interest.
• If null hypothesis is correct, 𝝌𝟐 𝑺𝑻𝑨𝑻 follows chi-square distribution with 1 degree of freedom.
• Row and Column totals are fixed and hence one degree of freedom is lost in each.
• Calculate the test statistic for our data (χ2 𝑆𝑇𝐴𝑇 ) for our data.
• Compare it with the cutoff values of χ2 distribution with 1 degree of freedom for a given α.
• Reject null of the χ2 𝑆𝑇𝐴𝑇 is in the region of rejection, or p-value is less than alpha.
BITS Pilani, Pilani Campus
Chi-square: Difference in two proportions
2 (𝑓𝑜 −𝑓𝑒 )2
• χ 𝑆𝑇𝐴𝑇 = σ𝐴𝑙𝑙 𝑐𝑒𝑙𝑙𝑠
𝑓𝑒
fo fe fo-fe (fo-fe)^2 (fo-fe)^2/fe
163.00 147.16 15.84 250.91 1.70
Conclusion: Proportion of customers who are willing to buy again is different in each store.
• Now the contingency table has two rows and more than two columns (‘c’ columns).
(𝑓𝑜 −𝑓𝑒 )2
• 𝑇𝑒𝑠𝑡 𝑠𝑡𝑎𝑡𝑖𝑠𝑡𝑖𝑐: χ2 𝑆𝑇𝐴𝑇 (Chi-square statistic) = σ𝐴𝑙𝑙 𝑐𝑒𝑙𝑙𝑠
𝑓𝑒
• 𝒇𝒐 : 𝑂𝑏𝑠𝑒𝑟𝑣𝑒𝑑 𝑓𝑟𝑒𝑞𝑢𝑒𝑛𝑐𝑦, 𝒇𝒆 : 𝐸𝑥𝑝𝑒𝑐𝑡𝑒𝑑 𝑓𝑟𝑒𝑞𝑢𝑒𝑛𝑐𝑦 𝑖𝑓 𝑡ℎ𝑒 null hypothesis is true.
• Overall estimated proportion of items of interest 𝑝ҧ = 𝑋𝑛 , X = total number of items of interest, n = total sample size.
• If null hypothesis is correct, 𝝌𝟐 𝑺𝑻𝑨𝑻 follows chi-square distribution with c-1 degrees of
freedom (why?).
H0: π1 = π2 = π3
𝑋 𝑡𝑜𝑡𝑎𝑙_𝑖𝑡𝑒𝑚𝑠_𝑜𝑓_𝑖𝑛𝑡𝑒𝑟𝑒𝑠𝑡 513
Expected proportion: 𝑝ҧ = 𝑛
=
𝑇𝑜𝑡𝑎𝑙_𝑠𝑎𝑚𝑝𝑙𝑒𝑠𝑖𝑧𝑒
=
700
= .733,
𝑎𝑛𝑑 (1 − 𝑝) = .267
Total (χ2)
40.23
(𝑓𝑜 −𝑓𝑒 )2
𝑇𝑒𝑠𝑡 𝑠𝑡𝑎𝑡𝑖𝑠𝑡𝑖𝑐: χ2 𝑆𝑇𝐴𝑇 (Chi-square statistic) = σ𝐴𝑙𝑙 𝑐𝑒𝑙𝑙𝑠
𝑓𝑒
24
Chi-square: Difference in more than two proportions
• Degrees of freedom?
• (n_rows-1)*(n_cols-1) = 2
Rject H0 𝐢𝐟 𝝌𝟐 𝑺𝑻𝑨𝑻 > 𝝌𝟐 𝜶
• χ𝑆𝑇𝐴𝑇 2 = 40.23
1. Price?
2. Location?
3. Staff Behavior?
4. Others?
• Now you would like test if the reason for not buying again is independent of the store?
• In other words, are the proportion of these reasons same across the stores?
• H1: Two categorical variables are dependent. (there is a relationship between them).
Location 39 13 8 60
Staff behavior 13 5 13 31
Others 13 8 8 29
Total 88 33 66 187
• H0: “Reasons to not buy again” is independent of the stores (there is no relationship).
• H1: “Reasons to not buy again” is dependent on the stores (there is a relationship between them).
• H1: Two categorical variables are dependent. (there is a relationship between them).
• Now the contingency table has more than two rows and more than two columns (‘c’ columns).
(𝑓𝑜 −𝑓𝑒 )2
• 𝑇𝑒𝑠𝑡 𝑠𝑡𝑎𝑡𝑖𝑠𝑡𝑖𝑐: χ2 𝑆𝑇𝐴𝑇 (Chi-square statistic) = σ𝐴𝑙𝑙 𝑐𝑒𝑙𝑙𝑠
𝑓𝑒
• 𝒇𝒐 : 𝑂𝑏𝑠𝑒𝑟𝑣𝑒𝑑 𝑓𝑟𝑒𝑞𝑢𝑒𝑛𝑐𝑦, 𝒇𝒆 : 𝐸𝑥𝑝𝑒𝑐𝑡𝑒𝑑 𝑓𝑟𝑒𝑞𝑢𝑒𝑛𝑐𝑦 𝑖𝑓 𝑡ℎ𝑒 null hypothesis is true.
• All the other mechanics of the hypothesis testing remains the same.
Degrees of freedom?
2. t distribution
▪ df= sample size-1
▪ 1 df is lost since standard deviation is computed from the sample.
3. F distribution
▪ dfN= sample sizeN-1, dfD=sample sizeD-1
▪ 1 df is lost each in Numerator and in Denominator since means are computed from the samples.
• Information about one variable conveys some information about the other.
Some examples
• Does knowing darkness of the clouds give information about chance of rain?
• Yes, there is a relationship. Positive: When one goes up, other also goes up on an average.
• Yes, there is a relationship. Negative: When one goes up, other goes down on an average.
• Is there a relationship between student weight and total marks? (No relationship)
• Knowing weight of a student does not give any information about her/his potential marks in the exam.
• See from a distribution lens and not from the absolute value lens.
• Which type of correlation 10-Year Bond yields and Us Equity market have?
𝑋ത =? 𝑋ത =5 ത
𝑌=? 𝑌ത =7 𝑛=? n=4
X Y X-𝑋ത Y-𝑌ത ത
(X-𝑋)(Y- ത
𝑌)
2 4 -3 -3 9
cov(X,Y) = 20/3 = 6.67
4 6 -1 -1 1
6 8 1 1 1
8 10 3 3 9
ഥ )(𝒀 − 𝒀
σ𝒏𝒊=𝟏(𝑿 − 𝑿 ഥ ) = 20
σ𝑛 ത 2
𝑖=1(𝑋−𝑋)
𝑋ത =5 ത
𝑌=7
• 𝑆𝑥 = X Y X-𝑋ത Y-𝑌ത ത 2
(𝑋 − 𝑋) ത 2
(𝑌 − 𝑌) ത
(𝑋 − 𝑋)(𝑌 ത
− 𝑌)
𝑛−1
2 4 -3 -3 9 9 9
σ𝑛 ത 2
𝑖=1(𝑌−𝑌)
4 6 -1 -1 1 1 1
• 𝑆𝑦 = 6 8 1 1 1 1 1
𝑛−1
8 10 3 3 9 9 9
Sum: 20 Sum: 20 Sum: 20
r=? r= 20/20 = 1
41
Coefficient of correlation
• Unit Independent.
• Varies between -1 and +1
• -1: Perfect negative linear correlation
• 0: No linear correlation.
• +1: Perfect positive linear correlation.
42
Q&A
43
Quantitative Methods
Lecture-13
BITS Pilani
Pilani Campus
1
BITS Pilani
Pilani Campus
• No Relationships
7 3.3 6.2 2
8 3.1 4.7
0
9 3.2 6.1 0 1 2 3 4 5 6 7
Customers within a 5km radius (X)
10 3.5 4.9
11 5.2 10.7
12 4.6 7.6
Is there a relationship between X and Y?
13 5.8 11.8
14 3 4.1
BITS Pilani, Pilani Campus
Predictions: Point Estimate
14
between X and Y
ത 6.63
8
𝑌= into account?
6
Mean is the point
4 estimate without taking
the relationship into
2 account.
0
0 1 2 3 4 5 6 7 Is every value of Y
X: Customers within a 5km radius ഥ?
equal to 𝒀
X=5.3
Error explained by the line 𝑌𝑖
= 9.8
12
𝒀
Residual error
10 𝒀
Annual Sales (Lakhs) Y
Is this estimate
8 ത 6.63
𝑌= better than the
6
point estimate?
Annual Sales (Lakhs) Y
4 Predicted Annual Sales (Lakhs) Y
2 Regression helps
us estimate the
0
0 1 2 3 4 5 6 7 equation of the
Customers (Lakhs) X linear relationship.
• X, is called an independent variable. Its values is determined outside the system (Exogenous).
6
• Equation of a line: 𝑌 = 𝛽0 + 𝛽1 𝑋
5
4
Intercept (𝛽0 )
3
• The point where the line meets Y axis.
2
• Value of Y, when X is 0
1
Slope (𝛽1 )
0
• When value of X goes up by 1 unit, the value of Y goes up by 𝛽1 units. 0 1 2 3 4 5 X
• Green line: Y = 1 + 2X (intercept? Slope?)
• 𝐼𝑛𝑡𝑒𝑟𝑐𝑒𝑝𝑡: 𝛽0 = 1, 𝑆𝑙𝑜𝑝𝑒: 𝛽1 = 2
• 𝑌𝑖 = 𝛽0 + 𝛽1 𝑋𝑖 + 𝜀𝑖
• 𝜀𝑖 : Random Error
12
10
Annual Sales
8
0
0 1 2 3 4 5 6 7
Customers within 5kms radium
10
• The line that minimizes the sum of
squared residual errors, is the best fit.
Annual Sales
6 2
• min σ𝐴𝑙𝑙 𝑣𝑎𝑙𝑢𝑒𝑠(𝑌𝑖 − 𝑌𝑖)
4
𝑆𝑆𝑋𝑌
– b1 =
𝑆𝑆𝑋
( σ𝑛 𝑛
𝑖=1 𝑋𝑖 )(σ𝑖=1 𝑌𝑖 )
– SSXY= σ𝑛𝑖 (𝑋𝑖 ത 𝑖 − 𝑌)
− 𝑋)(𝑌 ത = σ𝑛𝑖 𝑋𝑖 𝑌𝑖 −
𝑛
( σ𝑛
𝑖=0 𝑋𝑖 )
2
– SSX = σ𝑛𝑖 (𝑋𝑖 ത 2 = σ𝑛𝑖=0(𝑋𝑖 )2 −
− 𝑋) 𝑛
– b0 = 𝑌ത − 𝑏1 𝑋ത
𝑛
σ (𝑌 )
– 𝑌ത = 𝑖 𝑛 𝑖
𝑛
σ (𝑋 ) 𝑋𝑖 𝒀𝒊 ഥ)
(𝑿𝑖 − 𝑿 ത
(𝑌𝑖 − 𝑌) ഥ )2
(𝑿𝑖 − 𝑿
– 𝑋ത = 𝑖 𝑛 𝑖
• From your experience you find that your sales directly depend on number of potential customers within 5 sq
km radius of the stores.
• You can find number of potential customers within 5 sq km radius by using a market research firm.
• Yow would like to build a linear regression model to be able to predict potential sales.
• Linear Model: An equation of the line that can help you predict the dependent variable.
Annual Sales
4 5.6 9.5 8
5 3.3 5.4 6
6 2.2 3.5 4
7 3.3 6.2
2
8 3.1 4.7
0
9 3.2 6.1 0 1 2 3 4 5 6 7
Customers within 5kms radius
10 3.5 4.9
11 5.2 10.7
12 4.6 7.6
13 5.8 11.8
14 3 4.1
BITS Pilani, Pilani Campus
Linear Regression: Working through a business problem
Store Customers (Lakhs) X Annual Sales (Lakhs) Y X-Xbar (X-Xbar)^2 Y-Ybar (X-Xbar)(Y-Ybar)
1 3.7 5.7 -0.08 0.0062 -0.93 0.073
2 3.6 5.9 -0.18 0.0319 -0.73 0.130
3 2.8 6.7 -0.98 0.9576 0.07 -0.070
4 5.6 9.5 1.82 3.3176 2.87 5.230
5 3.3 5.4 -0.48 0.2290 -1.23 0.588
6 2.2 3.5 -1.58 2.4919 -3.13 4.939
7 3.3 6.2 -0.48 0.2290 -0.43 0.205
8 3.1 4.7 -0.68 0.4605 -1.93 1.309
9 3.2 6.1 -0.58 0.3347 -0.53 0.306
10 3.5 4.9 -0.28 0.0776 -1.73 0.482
11 5.2 10.7 1.42 2.0205 4.07 5.787
12 4.6 7.6 0.82 0.6747 0.97 0.798
13 5.8 11.8 2.02 4.0862 5.17 10.454
14 3 4.1 -0.78 0.6062 -2.53 1.969
Mean 3.78 6.63 SSX 15.5236 SSXY 32.199
b1 2.0742
b0 -1.2089
= −1.2089 + 2.0742*X
𝑬𝒔𝒕𝒊𝒎𝒂𝒕𝒆𝒅 𝒓𝒆𝒈𝒓𝒆𝒔𝒔𝒊𝒐𝒏 𝒍𝒊𝒏𝒆: 𝒀
• Predicated sales.
X: Number of customers within 5kms radius and 𝑌:
Caution:
• You have used a range of X values, from your sample, to estimate the regression equation (2.2 – 5.8 Lakh)
• Predictions may be invalid out of these range of values. We should not use regression for extrapolation.
12
10
Annual Sales
8
ത 6.63
𝑌=
6
0
0 1 2 3 4 5 6 7
Customers within 5kms radium
10
𝒀
Annual Sales (Lakhs) Y
0
0 1 2 3 4 5 6 7
Customers (Lakhs) X
• ത 2
𝑆𝑆𝑇 = σ𝑛𝑖=1(𝑌𝑖 − 𝑌)
• Regression Sum Of Squares Variation (SSR): Variation in Y
explained by the regression on Variable X.
• 𝑆𝑆𝑅 = σ𝑛𝑖=1(𝑌 − 𝑌)
ത 2
• 2
𝑆𝑆𝐸 = σ𝑛𝑖=1(𝑌𝑖 − 𝑌)
• Total Sum Of Squares Variation (SST): Measure of variation of Yi around the mean
• Regression Sum Of Squares Variation (SSR): Variation in Y explained by the regression on Variable X.
• Error Sum of Squares (SSE): Variation in Y not explained by X (Due to other factors).
• The proportion of variation in the values of Y, explained by the linear relationship between independent
variable X with the dependent variable Y.
𝑆𝑆𝑅
• 𝑆𝑋𝑌 =
𝑛−2
• 𝑆𝑆𝑅 = σ𝑛𝑖=1(𝑌 − 𝑌)
ത 2
• The standard deviation measures variation around the mean. 𝑆𝑋𝑌 measures the variation around the
regression line.
• 𝐻0 : 𝑏1 = 0
• Is 𝒃𝒐 the intercept and 𝒃𝟏 the slope significant (null of zero value is rejected) in the following output?
Standard
Coefficients Error t Stat P-value Lower 95% Upper 95% Lower 95.0% Upper 95.0%
Intercept -1.20884 0.994874 -1.21507 0.247707 -3.37648 0.958806 -3.37648 0.958806
Customers
(Lakhs) X 2.074173 0.253629 8.177972 3E-06 1.521562 2.626784 1.521562 2.626784
• F-statistics follows an F distribution with 1 and n-2, numerator and denominator degrees of freedom resp.
25
Quantitative Methods
Lecture-14
BITS Pilani
Pilani Campus
1
BITS Pilani
Pilani Campus
The goal
• Step1: Describe the objective - Example: Maximize revenue or minimize the cost.
• Step2: Describe each constraint – Example: Number of tons of material used <= total available.
• Step 3: Define the decision variables or controllable inputs. Example: Material produced (tons).
• Step 4: Write the objective in terms of decision variables. Example: Max 40P1 + 30P2.
• Step 5: Write the constraints in terms of decision variables. Example: 0.4P1 + .5P2 <=20
• Step 6: Add non-negativity constrains. Example: Non negative quantities or P1, P2>=0
• Profit contribution of the first and second products are 40 and 30 Rs respectively.
• You only have 20 tons of M1, 5 tons of M2 and 21 tons of M3 available in your inventory.
ton of the products Step 4: Write the objective in terms of decision variables.
Table1 P1 P2 Maximize 40P1 + 30P2
M1 0.4 0.5
Step 5: Write the constraints in terms of decision variables.
M2 0.2 M1 constraint: 0.4P1 + 0.5P2 <=20
M3 0.6 0.3 M2 constraint: 0.2P2 <=5
M3 constraint: 0.6P1 + 0.3P2 <=21
• Availability: 20 tons of M1, 5 tons of M2
and 21 tons of M3 Step6: Add non-negativity constraints.
P1, P2 >=0
BITS Pilani, Pilani Campus
Linear Programming Model
Subject to (s.t.)
M1) 0.4P1 + 0.5P2 <=20
M2) 0.2P2 <=5
M3) 0.6P1 + 0.3P2 <=21
P1, P2 >=0
Subject to (s.t.)
60 0.4P1 + 0.5P2 =20
1. P1, P2 >=0
2. M1) 0.4P1 + 0.5P2 <=20 50
• You can quickly find values of the objective function at extreme points and evaluate the solution.
• Extreme points are intersection of the constraint lines or a constraint line itself.
• Feasible region may be a line if the Obj Function line is parallel to a constraint (More than one
solution).
• Media selection.
• Marketing Research.
Financial Applications.
• Portfolio selection.
• Financial planning.
• Production scheduling.
• Workforce assignment.
• Blending problems.
BITS Pilani, Pilani Campus
Overall approach
• Overall approach remains the same as the simple two variable problem that we solved.
• Problems with two variables can be solved using graphical method (carry your scale etc. for the
exam).
• Problems with more than two variables can be solved using computer programs ( Solver etc.).
• You would primarily be assessed on your ability to write the linear programming model.
Marketing Applications
Marketing Applications: Media Selection
• Objective: A company would like to allocate budget to various media outlets to maximize the quality of
exposure etc.
• Media outlets? - News Paper, Internet Search, Daytime TV, Evening TV, Radio etc.
• Constraints: Minimum reach, budget, availability, quality of exposure requirements or company policy.
• At least 10 TV commercials
• At least 10 TV commercials
23