Descriptive Statistics
Visualizing a Single and multiple Variable
Hypothesis testing
Parametric and non-parametric tests
Error types
Thematic-Qualitative analysis
Week 6
Dealing with uncertainty
2
Decision making process
3
Statistical methods
Descriptive statistics
▪ It is the discipline of quantitatively describing the main features of a
collection of data
▪ Collecting, summarizing, processing data into useful information
Inferential statistics
▪ Provides the basis for prediction, and estimates that are used to
transform information about sample into inferences about population
4
Descriptive vs. inferential
5
Statistical analysis
▪ An analysis must have four elements
▪ Data/information (what)
▪ Scientific reasoning (Who? where? how? what happens?)
▪ Finding (what results?)
▪ Lesson/conclusion (so what? so how? )
Key definitions
Population vs. sample
7
Descriptive statistics
Why they are useful:
• Help us summarize the characteristics of our data/observations
• They form the initial step in a statistical analysis
• We get information about the centrality (e.g., mean, median)
• We get information about the variability (e.g., variance, standard
deviation)
8
Descriptive statistics
The Mean:
• Mean is another word for average.
• Most commonly used statistic that tells us about the centre of a data
set.
• The mean is important because it is involved in many statistical tests.
• E.g., T-test, ANOVA etc
• The sum of all values divided by the number of observations.
n=4
+ + + = 307
307 ÷4
9
Descriptive statistics
The Median : Example 2: 4,12,0,21,4,13 (n=6)
• Is the middle point of your ordered data • Step1: Order observations:
0,4,4,12,13,21
Example 1: 1,3,10,5,8 • 6 observations not a single point in the
Step1: Order the observations middle
1,3,5,8,10
• Step 2: Average the two middle points
The median is the number in the middle 4+12
𝑚𝑒𝑑𝑖𝑎𝑛 = =8
median=5 2
10
Descriptive statistics
Difference between Mean and Median
• Both are single values that represent the center of a data set
• But median is more robust or less affected to outliers
Example 3: 3,1,4,2.5,50 (n=5)
• 50 is a value quite extreme compared to the rest (outlier)
3+1+4+2.5+50
• Mean= =12.1
5
• Median: 1,2.5,3,4,50 =3
11
Measures of spread
12
Descriptive statistics
The Variance (𝑠 2 )
• A measure to show how spread out our observations are
• Based on the distance of each observation from the mean
13
Descriptive statistics
The Variance (𝑠 2 )
• Squared
• The average of the squared differences from the mean
Dog 1: 10kg
Dog 2: 12kg
Dog 3: 13kg
Dog 4: 17kg
Dog 5: 20kg
Dog 6: 24kg
Mean = 16kg
14
Descriptive statistics
The Variance (𝑠 2 )
1. Work out the difference from the mean and square
each value
2. Add all the squared values together
Dog 1: -6 36
Dog 2: -4 16
Dog 3: -3 9
Dog 4: 1 1
Dog 5: 4 16
Dog 6: 8 64
Mean = 16kg 142
15
Descriptive statistics
The Variance (𝑠 2 )
3. Divide the squared value by the number of
observations (n).
n=6
142
6 5- 1
Variance value:
28.4kg²
16
Descriptive statistics
The Standard deviation (s) :
• It is the square root of variance
• The result is in the same measurement units as our data (e.g., kg)
• This makes it easier to interpret and understand the spread of the
data than variance alone
17
Descriptive statistics
The Standard deviation (s) :
28.4
= 5.3kg
18
Descriptive statistics
The Standard deviation (s) :
• Often plotted as error bars above and below the mean (5.3kg
in our example).
25
• Small value indicates
20 data are gathered close
to the mean
Weight (kg)
15
10
• Large value indicates
5 data are gathered far
0 from the mean
19
Know the data and explore it
▪ Exploratory data analysis (EDA): Purpose and Benefits
▪ Size, Dimension, and Resolution of Data
▪ Types of Attributes
▪ Statistical EDA
▪ Measures of Central Tendencies and Spread
▪ Bivariate EDA: Correlation, Contingency Table
▪ Graphical EDA Types of Diagrams
20
Types of data
Types of data based on number
of attributes
▪ Univariate Data
▪ Bivariate Data
▪ Multivariate Data
21
Types of data
22
Types of data
23
Normal Distribution (Bell-curve)
24
Bivariate measures
25
Contingency Table
26
Covariance and correlation
27
Covariance and correlation
Covariance and correlation are both statistical measures used to assess the relationship between two variables.
However, they differ in how they quantify that relationship and the units they use. Here's a breakdown of the key
differences:
Covariance:
Measures: The direction and strength of the linear relationship between two variables.
Units: The product of the units of the original variables.
Correlation:
Measures: The strength and direction of the linear relationship between two variables, but in a standardized way.
Units: No units (ranges from -1 to +1).
Interpretation:
A correlation coefficient of +1 indicates a perfect positive linear relationship. As one variable increases, the other
increases proportionally.
A correlation coefficient of -1 indicates a perfect negative linear relationship. As one variable increases, the other
decreases proportionally.
A correlation coefficient of 0 indicates no linear relationship.
Values between -1 and +1 indicate the strength of the linear relationship, with values closer to +1 or -1 indicating
stronger relationships.
28
Covariance and correlation
29
Covariance and correlation
30
Diagrammatic Representations of Data
▪ Easy to understand:
▪ Numbers do not tell all the story.
▪ Diagrammatic representation of data makes it easier to understand
▪ Simplified Presentation:
▪ Large volumes of complex data can be represented in a simplified and diagram
▪ Reveals hidden facts:
▪ Diagrams help in bringing out the facts and relationships between data not
noticeable in raw/tabular form
▪ Easy to compare:
▪ Diagrams make it easier to compare data
31
Diagrammatic Representations of Dat
▪ Bar Charts
▪ Histogram
▪ Box Plot
▪ Scatter Plot
▪ Heat map
▪ Line Graph
32
Parametric vs. Non-parametric tests
Parametric Tests:
Assumptions: Parametric tests assume that the data comes from a population that follows a specific probability distribution, such as a normal distribution (bell curve). They also rely on certain characteristics of the
data, such as equal variances between groups
Non-Parametric Tests: Field 1 Field 2
15.2 15.9
Assumptions: Non-parametric tests make fewer assumptions about the underlying population distribution. They can be used with data that doesn't follow a normal distribution or
when the data characteristics are unknown. 15.3 15.9
16 15.2
Hypothesis Testing, Students t-test 15.8
15.6
16.6
15.2
14.9 15.8
15 15.8
▪ Field 1 and Field 2
15.4 16.2
15.6 15.6
15.7 15.6
▪ Took a sample from Field 1 and 2 15.5
15.2
15.8
15.5
▪ Can you tell which one has high Yield? 15.5
15.1
15.5
15.5
▪ Null hypothesis:
15.3 14.9
15 15.9
There is no statistically significant difference
between the samples.
▪ Decision:
▪If t-value < t-critical >>>>Don’t reject Null
▪If t-value > t-critical >>>>Reject Null
Students t-test
t-table
▪Decision:
▪If t-value < t-critical >>>>Don’t reject Null
▪If t-value > t-critical >>>>Reject Null
Students t-test
Dof = n1 + n2 - 2
Null hypothesis:
There is no statistically significant difference between the samples.
▪ t-value > t-critical
▪ 2.3 > 2.04
▪That means, there is some statistically significant difference between
the samples
t-table
Students t-test Plant 1 Plant 2
38 32
Null hypothesis: 52 39
There is no statistically significant 48 54
difference between the samples 25 47
39 41
▪ t-value < t-critical ?? 51 34
▪ t-value > t-critical ?? 46 30
55 36
▪Decision: 46 36
▪If t-value < t-critical >>>>Don’t reject Null
▪If t-value > t-critical >>>>Reject Null 53 38
45 46
42 58
54 52
65 29
56 76
67 46
74 46
32 45
Mean 4348.09524 46.80952 78
STD 11.77669 15.11826
34
Variance 138.6905 228.5619
80
n 45 21 21 40
Rubber Rubber Rubber
Analysis of variance (ANOVA) supplier 1 supplier 2 supplier 3
1 2 2
Step 1: 2 4 3
Null hypothesis: 5 2 4
There is no difference between means
µ1 = µ2 = µ3
Alternative:
At least there is one difference among the means
Alpha = 0.05
Step 2
Find critical F-value
- Dof (between-numerator) = k – 1 = 3 – 1 = 2
k (number of conditions in our group)
- Dof (within-denominator) = N – k = 9 – 3 = 6,
N (total number of scores we have in sample
- Dof (total) = 8
- F-Critical = 5.14 (from table)
Rubber Rubber Rubber
supplier 1 supplier 2 supplier 3
1 2 2
ANOVA 2
5
4
2
3
4
Step 3:
Analysis of sum of squares-total variability SS (within) = Sum of squares (within)
Mean for each condition/group = Sum (x1 – mean (x1))^2
- Mean x1 = 2.67 + Sum (x2 – mean (x2))^2
- Mean x2 = 2.67 + Sum (x3 – mean (x3))^2
- Mean x3 = 3.00
= (1-2.67)^2 + (2- 2.67)^2 + (5-2.67)^
Grand mean (G) = G/N = + (2-2.67)^2 + (4- 2.67)^2 + (2-2.67)^
= (1+2+5+2+4+2+2+3+4)/9 + (2-3)^2 + (3- 3)^2 + (4-3)^2
G = 2.78
SS (within) = 13.34
SS (total) = Sum of squares (total)
= Sum (x - G)^2 SS (between) = SS(total) – SS (within)
= (1-2.78)^2 + (2- 2.78)^2 + (5-2.78)^2 = 13.6 – 13.34
+ (2-2.78)^2 + (4- 2.78)^2 + (2-2.78)^2 = 0.24
+ (2-2.78)^2 + (3- 2.78)^2 + (4-2.78)^2
SS (total) = 13.6
Null hypothesis:
There is no difference between means
ANOVA µ1 = µ2 = µ3
Step 4: Step 5:
Variance (between) F-value = MS(between)/MS (within)
Variance (within) = 0.12/2.22
= 0.054
Mean square = MS (between)
= SS (between)/Dof (between) F-critical = 5.14 Remember!!!
= 0.24/2
= 0.12 F-value < F-critical
Mean square = MS (within) 0.054 < 5.14
= SS (within)/Dof (within)
= 13.34/6 Conclusion:
= 2.22 We fail to reject null hypothesis
▪Decision:
▪If F-value < F-critical >>>>Don’t reject Null
▪If F-value > F-critical >>>>Reject Null
Practicing ANOVA
Goods Goods Goods
supplier 1 supplier 2 supplier 3
30 19 60
34 22 51
39 26 53
Hypothesis Testing-Wilcoxon Rank Sum Test
▪Wilcoxon with both n1 and n2 < 10 or n1 and n2 ≥ 10
▪When we test a hypothesis about the difference between two
independent population means, we do so using the difference
between two sample means.
▪ When the two sample variances are tested and found not to be
equal
• As we cannot use the sample variances
• thus we cannot use the t-test for independent samples. Instead, we use
the Wilcoxon Rank Sum Test
When comparing two groups using a t-test for independent samples, it's typically assumed that the variances of the two groups are equal. However, if we find through a test of variances (such as Levene's test) that the
variances are significantly different, we can't rely on the t-test anymore because it assumes equal variances. In this case, we need an alternative method that doesn't make this assumption.
One such alternative is the Wilcoxon Rank Sum Test, also known as the Mann-Whitney U test.
Wilcoxon Rank Sum Test
The Z test and the t test are “parametric tests” – that is, they answer a
question about the difference between populations by comparing
sample statistics (e.g., X1 and X2) and making an inference to the
population parameters (μ1 and μ2).
The Wilcoxon, in contrast, allows inferences about whole populations
Here's a simplified explanation of how the Wilcoxon Rank Sum Test works:
Combine the data from both groups and rank them from lowest to highest, assigning ranks without regard to which group the data came from.
Calculate the sum of ranks for each group.
The test statistic is the smaller of the two rank sums.
Compare the test statistic to a critical value from the Wilcoxon Rank Sum Test table or use software to calculate the p-value.
Small samples, independent groups
Wilcoxon Rank Sum Test
• first, combine the two samples and rank order all the
observations
• smallest number has rank 1, largest number has rank
N (= sum of n1 and n2)
• separate samples and add up the ranks for the smaller
sample (If n1 = n2, choose either one)
• test statistics : rank sum T for smaller sample
Small samples, independent groups
Wilcoxon – Rejection region:
(With Sample taken from Population A being smaller than sample for
Population B) – reject H0 if
TA ≥ TU or TA ≤ TL
Small samples, independent groups
Wilcoxon for n1 ≥ 10 and n2 ≥ 10:
Test statistic:
Wilcoxon for n1≥ 10 and n2 ≥ 10
Rejection region:
One-tailed Two-tailed
Z > Zα │Z│ > Zα/2
Note: use this only when n1≥ 10 and n2 ≥ 10
Wilcoxon
Example 1
- These are small samples, and they are independent (“random samples
of Cajun and Creole dishes”)
- Therefore, we must begin with the test of equality of variances
Cajun Creole
3500 3100
4200 4700
4100 2700
4700 3500
4200 2000
3705 3100
4100 1550
Test of hypothesis of equal variances
H0: 12 = 22
HA: 12 ≠ 22
Test statistic: F = S12
S22
Rej. region: F > Fα/2 = F(6,6,.025) = 5.82 Use table or Excel
=F.INV.RT(prob,df1,df2)
or F < (1/5.82) = .172
Test of hypothesis of equal variances
S2Cajun = (385.27)2 = 148432.14 ▪If F-value < F-critical >>>>Don’t reject Null
▪If F-value > F-critical >>>>Reject Null
S2Creole = (1027.54)2 = 1055833.33
Fobt = 1055833.33 = 7.11
148432.14
Reject H0 – variances are not equal, so we do the Wilcoxon rank sum test
Example 1 – Wilcoxon Rank Sum Test
H0: Prob. distributions for Cajun and Creole populations are identical
HA: Prob. distribution for Cajun is shifted to right of distribution for Creole
Statistical test: T
Rejection region:
Reject H0 if TCajun > 66 (or if TCreole < 39)
(Note: We shall give lower heat values lower rank values)
Example 1 – Wilcoxon Rank Sum Test
Cajun Creole
6.5 4.5
3500 3100
11.5 13.5
4200 4700
9.5 3
4100 13.5 2700
6.5
4700 11.5 3500 2
4200 8 2000 4.5
3705 9.5 3100 1
4100 Σ 70 1550 35
Example 1 – Wilcoxon Rank Sum Test
Calculation check:
Sum of the ranks should = (n) (n+1)
2
70 + 35 = 105 = (14)(15)
2
Example 1 – Wilcoxon Rank Sum Test
TCajun = 70 > 66 (and TCreole = 35 < 39)
Therefore, reject H0 – Cajun dishes are significantly hotter than Creole
dishes.
Rejection region:
- TA ≥ TU or TA ≤ TL
- Reject H0 if TCajun > 66 (or if TCreole < 39)
Example 2 – Wilcoxon Rank Sum Test
Male Female
H0: 12 = 22 6.4 2.7
1.7 3.9
HA: 12 ≠ 22 3.2 4.6
5.9 3.0
2.0 3.4
Test statistic: F= S12 3.6 4.1
S22 5.4 3.4
7.2 4.7
3.8
Rej. region: F > Fα/2 = F(7,8,.025) = 4.53
or F < (1/4.90) = .204
Example 2 – Wilcoxon Rank Sum Test
Fobt = 4.316 = 9.38
.46
Reject H0 – do Wilcoxon
Example 2 – Wilcoxon Rank Sum Test
H0: Prob. distributions for females and males populations are identical.
HA: Prob. distribution for females is shifted to left of distribution for
males.
Statistical test: T
Rejection region:
T > TU = 90 (or T < TL = 54)
Example 2 – Wilcoxon Rank Sum Test
6.4 16 2.7 3
1.7 1 3.9 10
3.2 5 4.6 12
5.9 15 3.0 4
2.0 2 3.4 6.5
3.6 8 4.1 11
5.4 14 3.4 6.5
7.2 17 4.7 13
3.8 9
Σ 78 75
Example 2 – Wilcoxon Rank Sum Test
T = 78 < TU = 90
Therefore, do not reject H0 – no evidence that mean distance in
females is less than that in males.
Rejection region:
T > TU = 90 (or T < TL = 54)
Example 3 – Wilcoxon Rank Sum Test
Hoodoo Mukluk
H0: 12 = 22 2 6
HA: 12 ≠ 22 6 8
4 7
Test statistic: F= S12 23 10
7 8
S22
6 4
Rej. region: F > Fα/2 = F(5,5,.025) = 7.15
or F < (1/7.15) = .140
Example 3 – Wilcoxon Rank Sum Test
Fobt = (7.563)2 = 57.20 Rej. region: F > Fα/2 = F(5,5,.025) = 7.15
(2.04)2 4.16
= 13.74
Reject H0 – do Wilcoxon
Example 3 – Wilcoxon Rank Sum Test
H0: Prob. distributions for Hoodoo and Mukluk populations are
identical
HA: Prob. distribution for Hoodoos is shifted to right or left of
distribution for Mukluks.
Statistical test: T
Rejection region: TH > 52
Example 3 – Wilcoxon Rank Sum Test
Hoodoo Mukluk
2 1 6 5
6 5 8 9.5
4 2.5 7 7.5
23 12 10 11
7 7.5 8 9.5
6 5 4 2.5
Σ 33 45
Example 3 – Wilcoxon Rank Sum Test
Rejection region: TH > 52
Check: TH + TM = 78
(12)(13) = 78
2
TH = 33 > 26 and < 52
Do not reject H0 – no evidence for a significant difference between
teams.
Type I and II Error
The true status of the null hypothesis…
about the null hypothesis… True False
The researcher’s decision
True Correct Type II Error
False Type I Error Correct
Qualitative Models for Forecasting of theme/trend
▪ Knowledge and Insight of the Products
▪ Historical analogy/Market surveys
▪ Delphi Method
▪ Jury of Executive Opinion
Judgmental-Knowledge and Insight of the Products
- It rely on experience and awareness
- They are necessary when historical data are not available or when
the decision maker needs to forecast far into the future
- For example, a prediction of when the next generation of a
microprocessor will be available and what capabilities it might have
will depend greatly on the opinions and expertise of individuals
who understand the technology
68
Historical analogy
- A prediction is obtained through a comparative analysis with a
previous situation
- If a new product is being introduced, the response of consumers to
marketing campaigns to similar, previous products can be used as a
basis to predict how the new marketing campaign might charge
69
The Delphi Method
- It uses a panel of experts, whose identities are kept confidential
from one another, to respond to a sequence of questionnaires
- After each round of responses, individual opinions, are shared,
allowing each to see what the other experts think
- Seeing other experts’ opinions helps to strengthen those in
agreement and to influence those who did not agree
- In the next round, the experts revise their estimates, and the
process is repeated, usually for no more than two or three rounds
70
Qualitative
- It gathers data about lived experiences, emotions or
behaviours, and the meanings individuals attach to them
- It assists in enabling researchers to gain a better understanding
of complex concepts, social interactions or cultural phenomena
- This type of research is useful in the exploration of how or why
things have occurred, interpreting events and describing
actions.
Qualitative
- It gathers numerical data which can be ranked, measured or
categorized through statistical analysis.
- It assists with uncovering patterns or relationships, and for
making generalizations.
- This type of research is useful for finding out how many, how
much, how often, or to what extent.
Quantitative Vs. Qualitative