SlideShare a Scribd company logo
1 of 24
Download to read offline
Statistical Inference
Week 3: Hypothesis Testing and t-tests
Central Limit Theorem
 What is the mean height (𝜇) of all primary school children in Singapore?
Sample =
Anderson Primary
Population = All
primary school
children in SG
Sample = Damai
Primary
Sample = Red
Swastika Primary
Sample =
Zhenghua Primary
𝒙 𝑨𝒏𝒅𝒆𝒓𝒔𝒐𝒏 𝑷𝒓𝒊𝒎𝒂𝒓𝒚 = Mean height of
100 children from Anderson Primary
𝒙 𝑫𝒂𝒎𝒂𝒊 𝑷𝒓𝒊𝒎𝒂𝒓𝒚 = Mean height of 100
children from Damai Primary
𝒙 𝑹𝒆𝒅 𝑺𝒘𝒂𝒔𝒕𝒊𝒌𝒂 = Mean height of 100
children from Red Swastika Primary
𝒙 𝒁𝒉𝒆𝒏𝒈𝒉𝒖𝒂 𝑷𝒓𝒊𝒎𝒂𝒓𝒚= Mean height of 100
children from Zhenghua Primary
𝐷𝑖𝑠𝑡𝑟𝑖𝑏𝑢𝑡𝑖𝑜𝑛 𝑜𝑓 𝑚𝑒𝑎𝑛 ℎ𝑒𝑖𝑔ℎ𝑡 ~ 𝑁(𝑚𝑒𝑎𝑛 = 𝜇, 𝑠𝑡𝑎𝑛𝑑𝑎𝑟𝑑 𝑒𝑟𝑟𝑜𝑟 =
𝜎
100
)
…
…
…
From the sampling
distribution:
 Mean( 𝑥) ≈ 𝜇
 SD( 𝑥) < 𝜎
− As sample size
increases, SD
decreases
Central Limit Theorem (CLT)
 The distribution of sample statistics (e.g., mean) is approximately
normal, regardless of the underlying distribution, with mean =
𝜇 and variance =
𝜎2
𝑁
𝒙 ~ 𝑵(𝒎𝒆𝒂𝒏 = 𝝁, 𝒔𝒕𝒂𝒏𝒅𝒂𝒓𝒅 𝒆𝒓𝒓𝒐𝒓 =
𝝈
𝒏
)
 Further experimentation: http://bitly.com/clt_mean
Distribution is
normal
Sample mean =
population mean
Sample sd = population
sd divided by square root
of sample size
Applet source: Mine Çetinkaya-Rundel, Duke University
Conditions for CLT
 Independence: Sampled observations must be independent:
− Random sample/assignment
− If sampling without replacement, n < 10% of population
 Sample Size/Skew:
− Population should be normal
− If not, sample size should be large (rule of thumb: n > 30)
Confidence Interval
 An interval estimate of a
population parameter
− Computed as sample mean +/- a
margin of error
𝑥 ± 𝑧 × 𝑆𝐸, where SE =
𝑠
𝑛
− 95% confidence interval would
contain 95% of all values and would
be 𝑥 ± 2𝑆𝐸 or 𝑥 ± 1.96 ×
𝑠
𝑛
𝑪𝑳𝑻: 𝒙 ~ 𝑵(𝒎𝒆𝒂𝒏 = 𝝁, 𝒔𝒕𝒂𝒏𝒅𝒂𝒓𝒅 𝒆𝒓𝒓𝒐𝒓 =
𝝈
𝒏
)
Confidence Interval
 You have taken a random sample of 100 primary school children in
Singapore. Their heights had mean = 150cm and sd = 10cm.
Estimate the true average height of primary school children based on
this sample using a 95% confidence interval.
 We are 95% confident that primary school children mean height is
between 148.04cm and 151.96cm
Confidence Interval: 𝑥 ± 𝑧 × 𝑆𝐸
𝑛 = 100
𝑥 = 150
𝑠𝑑 = 10
𝑆𝐸 =
𝑠𝑑
𝑛
=
10
100
= 1
𝑥 ± 𝑧 × 𝑆𝐸 = 150 ± 1.96 × 1
= 150 ± 1.96
= (148.04, 151.96)
Required sample size for margin of error
 Given a target margin of error and confidence level, and information
on the standard deviation of sample (or population), we can work
backwards to determine the required sample size.
 Previous measurements of primary school children heights show sd =
15cm. What should be the sample size in order to get a 95%
confidence interval with a margin of error less than or equal 1cm?
Margin of error: ≤ 1𝑐𝑚
Confidence level: 95%
𝑧 = 1.96
𝑠𝑑 = 15
𝑀𝐸 = 𝑧 × 𝑆𝐸
1 = 1.96 ×
15
𝑛
𝑛 = (
1.96 × 15
1
)2
𝑛 = (29.4)2 = 864.36
Thus, we need a sample size of at
least 865 primary school children
Hypothesis Testing
 Null hypothesis 𝐻0
− The status quo that is assumed to be true
 Alternative hypothesis (𝐻 𝑎)
− An alternative claim under consideration that will require statistical
evidence to accept, and thus, reject the null hypothesis
 We will consider 𝐻0 to be true and accept it unless the evidence
in favour of 𝐻 𝑎 is so strong that we reject 𝐻0 in favour of 𝐻 𝑎.
Hypothesis Testing
 Earlier, we found the sample of 100 primary school children had
mean height = 150cm and sd = 10cm. Based on this statistic,
does the data support the hypothesis that primary school children
on average are shorter than 151cm?
𝐻0: μ = 151 #primary school students have mean height = 151
𝐻 𝑎: 𝜇 < 151 #primary school students have mean height < 151
P-value
 Probability of obtaining the observed result or results that are
more “extreme”, given that the null hypothesis is true
− P(observed or more extreme outcome | 𝐻0 is true)
− If the p-value is low (i.e., lower than the significance level (𝛼), usually 5%),
then we say that it is very unlikely to observe the data if the null
hypothesis was true, and reject 𝐻0
− If the p-value is high (i.e., higher than 𝛼), we say that it is likely to observe
the data even if the null hypothesis was true, and thus do not reject 𝐻0
Hypothesis Testing and P-value
 Recall that the sample of 100 primary school children had mean
height = 150cm and sd = 10cm. Also take sig. level = 0.05
𝑥 = 150cm; sd = 10cm; SE =
10
100
= 1 #what we know from the sample
𝑋 ~𝑁(𝜇 = 151, 𝑆𝐸 = 1) #null hypothesis of the population
Test Statistic:
𝑍 =
150 − 151
1
= −1
P-value:
𝑃 𝑍 < −1 = 1 − 0.8413
= 0.1587
Since p-value is higher than 0.05,
we do not reject 𝐻0
𝜇 = 151150
0.1587
Hypothesis Testing and P-value
 Interpreting p-value
− If in fact, primary school children have mean height of 151cm, there is a
15.9% chance that a random sample of 100 children would yield a sample
mean of 150cm or lower
− This is a pretty high probability
− Thus, the sample mean of 150 could have
likely occurred by chance
Two-sided Hypothesis Testing
 What is the probability that the children have mean height different
from 151cm?
𝐻0: μ = 151 #primary school students have mean height = 151
𝐻 𝑎: 𝜇 ≠ 151 #primary school students have mean height ≠ 151
P-value:
𝑃 𝑍 < −1 + 𝑃 𝑍 > 1
= 2 × 1 − 0.8413
= 0.3174
𝜇 = 151150
0.1587 0.1587
152
Hypothesis Testing and Confidence Intervals
 If the confidence interval contains the null value, don’t reject 𝐻0. If
the confidence interval does not contain the null value, reject 𝐻0.
− Previously, we found the 95% confidence interval for heights of primary
school children to be (148, 152). Given that our null hypothesis(𝐻0 =
151cm) falls within this 95% CI, we do not reject it.
 A two-sided hypothesis with significance level 𝛼 is equivalent to a confidence
interval with 𝐶𝐿 = 1 − 𝛼
 A one-sided hypothesis with a significance level 𝛼 is equivalent to a
confidence interval with 𝐶𝐿 = 1 − 2𝛼
148 cm 152 cm
95% confident that the average
height is between 148 and 152 cm
Decision Errors
 Which error is worse to commit (in a research/business context)?
− Type II: Declaring the defendant innocent when they are actually guilty
− Type I: Declaring the defendant guilty when they are actually innocent
“Better that ten guilty persons escape than that one innocent suffer”
- William Blackstone
Fail to reject 𝐻0 Reject 𝐻0
𝐻0 is True  Type I error
𝐻0 is False Type II error 
Type I Error rate
 We reject 𝐻0 when the p-value is less than 0.05 (𝛼=0.05)
− I.e., Should 𝐻0 actually be true, we do not want to incorrectly reject it
more than 5% of the time
− Thus, using a 0.05 significance level is equivalent to having a 5% chance
of making a Type I error
 Choosing significance levels
− If Type I Error is costly, we choose a lower significance level (e.g., 0.01)
− E.g., spam filtering
− If Type II Error is costly, we choose a higher significance level (e.g., 0.10)
− E.g., airport baggage screening
Fail to reject 𝐻0 Reject 𝐻0
𝐻0 is True  Type I error (𝛼)
𝐻0 is False Type II error (𝛽) 
Student’s t Distribution
 According to CLT, the distribution of sample statistics is
approximately normal, if:
− Population is normal
− Sample size is large (n > 30)
 If so, we can use the population sd (𝜎) to compute a z-score
 However, sample sizes are sometimes small and we often do not
know the standard deviation of the population (𝜎)
− Thus, the normal distribution may not be appropriate
 Thus, we rely on the t distribution
Shape of the t distribution
 Bell shaped but thicker tails than the normal
− Thus, observations are more likely to fall beyond 2sd from the mean
− The thicker tails are helpful in adjusting for the less reliable data on the
standard deviation (when n is small and/or 𝜎 is unknown)
Shape of the t distribution
 Has one parameter, degrees of freedom (df), which determines
the thickness of the tails
− df refers to the number of independent observations in data set
− Number of independent observations = sample size minus 1
− E.g., in a sample size of 8, there are (8-1) degrees of freedom
 What happens to the shape of the
t distribution when df increases?
− It approaches the normal distribution
When to use the t distribution
 In general, we use the t distribution when:
− N is small (n < 30) and/or;
− 𝜎 is unknown
 However, nowadays, our sample sizes are usually above 30
− Thus, why bother with the t distribution?
− Because 95% of the world prefers the t distribution to the normal and
you’ll definitely encounter it eventually
− If you’re unsure, use the t distribution since it approximates to the normal
distribution with large sample sizes
Independent and Dependent t-tests
 When to use independent and dependent t-tests?
− Dependent: when evaluating the effect between two related samples
− You feed a group of 100 people fast food everyday
− Did they gain weight after 30 days?
− Independent: when evaluating the effect between two independent samples
− You feed 50 males and 50 females fast food everyday
− Did males or females gain more weight after 30 days?
 You conduct a study with two groups and have them exercise three
times a day for 30 days (group A = crossfit, group B = yoga).
− How would you test the difference between crossfit and yoga participants?
− How would you test the difference in weight between day 0 and day 30 for
yoga participants?
Effect Size
 When samples become large enough, you often get significant results
− However, is it practically significant?
 Effect size is a simple way to quantify difference between two groups
− Emphasizes the size of the difference (without effect of sample size)
− Cohen’s d is one of the most common ways to measure effect size
Effect size:
Proper calculation for 𝑆𝐷 𝑝𝑜𝑜𝑙𝑒𝑑:
Simple calculation for 𝑆𝐷 𝑝𝑜𝑜𝑙𝑒𝑑:
Time for practice
 In this lab session we will cover:
− Independent t-tests
− Dependent (paired) t-tests
− Effect size (Cohen’s d)
 GitHub repository: https://github.com/eugeneyan/Statistical-Inference
Thank you for your attention!
Eugene Yan

More Related Content

What's hot (20)

Confidence Intervals
Confidence IntervalsConfidence Intervals
Confidence Intervals
 
Point Estimation
Point Estimation Point Estimation
Point Estimation
 
Estimation and hypothesis
Estimation and hypothesisEstimation and hypothesis
Estimation and hypothesis
 
The median test
The median testThe median test
The median test
 
One Sample T Test
One Sample T TestOne Sample T Test
One Sample T Test
 
Hypothesis Testing
Hypothesis TestingHypothesis Testing
Hypothesis Testing
 
z-scores
z-scoresz-scores
z-scores
 
Chapter 3 Confidence Interval
Chapter 3 Confidence IntervalChapter 3 Confidence Interval
Chapter 3 Confidence Interval
 
Choosing a statistical test
Choosing a statistical testChoosing a statistical test
Choosing a statistical test
 
Probability Distributions
Probability DistributionsProbability Distributions
Probability Distributions
 
Chapter 6 part2-Introduction to Inference-Tests of Significance, Stating Hyp...
Chapter 6 part2-Introduction to Inference-Tests of Significance,  Stating Hyp...Chapter 6 part2-Introduction to Inference-Tests of Significance,  Stating Hyp...
Chapter 6 part2-Introduction to Inference-Tests of Significance, Stating Hyp...
 
Statistical Estimation
Statistical Estimation Statistical Estimation
Statistical Estimation
 
t-TEst. :D
t-TEst. :Dt-TEst. :D
t-TEst. :D
 
Calculating p value
Calculating p valueCalculating p value
Calculating p value
 
Hypothesis Testing
Hypothesis TestingHypothesis Testing
Hypothesis Testing
 
Sample Size Determination
Sample Size DeterminationSample Size Determination
Sample Size Determination
 
Hypothesis testing
Hypothesis testingHypothesis testing
Hypothesis testing
 
STATISTIC ESTIMATION
STATISTIC ESTIMATIONSTATISTIC ESTIMATION
STATISTIC ESTIMATION
 
Confidence interval
Confidence intervalConfidence interval
Confidence interval
 
Chapter 7 – Confidence Intervals And Sample Size
Chapter 7 – Confidence Intervals And Sample SizeChapter 7 – Confidence Intervals And Sample Size
Chapter 7 – Confidence Intervals And Sample Size
 

Similar to Statistical inference: Hypothesis Testing and t-tests

Confidence Interval ModuleOne of the key concepts of statist.docx
Confidence Interval ModuleOne of the key concepts of statist.docxConfidence Interval ModuleOne of the key concepts of statist.docx
Confidence Interval ModuleOne of the key concepts of statist.docxmaxinesmith73660
 
2_5332511410507220042.ppt
2_5332511410507220042.ppt2_5332511410507220042.ppt
2_5332511410507220042.pptnedalalazzwy
 
Normal and standard normal distribution
Normal and standard normal distributionNormal and standard normal distribution
Normal and standard normal distributionAvjinder (Avi) Kaler
 
Pengenalan Ekonometrika
Pengenalan EkonometrikaPengenalan Ekonometrika
Pengenalan EkonometrikaXYZ Williams
 
Lect 10 Sample Size Estimation.ppt
Lect 10 Sample Size Estimation.pptLect 10 Sample Size Estimation.ppt
Lect 10 Sample Size Estimation.pptNaolAbebe8
 
Confidence intervals
Confidence intervalsConfidence intervals
Confidence intervalsTanay Tandon
 
Statistical inference: Statistical Power, ANOVA, and Post Hoc tests
Statistical inference: Statistical Power, ANOVA, and Post Hoc testsStatistical inference: Statistical Power, ANOVA, and Post Hoc tests
Statistical inference: Statistical Power, ANOVA, and Post Hoc testsEugene Yan Ziyou
 
Introduction-to-Analyzing-Statistical-Data.pdf
Introduction-to-Analyzing-Statistical-Data.pdfIntroduction-to-Analyzing-Statistical-Data.pdf
Introduction-to-Analyzing-Statistical-Data.pdfchrisv1443
 
A Lecture on Sample Size and Statistical Inference for Health Researchers
A Lecture on Sample Size and Statistical Inference for Health ResearchersA Lecture on Sample Size and Statistical Inference for Health Researchers
A Lecture on Sample Size and Statistical Inference for Health ResearchersDr Arindam Basu
 
RMH Concise Revision Guide - the Basics of EBM
RMH Concise Revision Guide -  the Basics of EBMRMH Concise Revision Guide -  the Basics of EBM
RMH Concise Revision Guide - the Basics of EBMAyselTuracli
 
M.Ed Tcs 2 seminar ppt npc to submit
M.Ed Tcs 2 seminar ppt npc   to submitM.Ed Tcs 2 seminar ppt npc   to submit
M.Ed Tcs 2 seminar ppt npc to submitBINCYKMATHEW
 
Answer the questions in one paragraph 4-5 sentences. · Why did t.docx
Answer the questions in one paragraph 4-5 sentences. · Why did t.docxAnswer the questions in one paragraph 4-5 sentences. · Why did t.docx
Answer the questions in one paragraph 4-5 sentences. · Why did t.docxboyfieldhouse
 

Similar to Statistical inference: Hypothesis Testing and t-tests (20)

Confidence Interval ModuleOne of the key concepts of statist.docx
Confidence Interval ModuleOne of the key concepts of statist.docxConfidence Interval ModuleOne of the key concepts of statist.docx
Confidence Interval ModuleOne of the key concepts of statist.docx
 
2_5332511410507220042.ppt
2_5332511410507220042.ppt2_5332511410507220042.ppt
2_5332511410507220042.ppt
 
Normal and standard normal distribution
Normal and standard normal distributionNormal and standard normal distribution
Normal and standard normal distribution
 
Other Measures of Location
Other Measures of LocationOther Measures of Location
Other Measures of Location
 
Pengenalan Ekonometrika
Pengenalan EkonometrikaPengenalan Ekonometrika
Pengenalan Ekonometrika
 
Lect 10 Sample Size Estimation.ppt
Lect 10 Sample Size Estimation.pptLect 10 Sample Size Estimation.ppt
Lect 10 Sample Size Estimation.ppt
 
Confidence intervals
Confidence intervalsConfidence intervals
Confidence intervals
 
U unit8 ksb
U unit8 ksbU unit8 ksb
U unit8 ksb
 
Statistical inference: Statistical Power, ANOVA, and Post Hoc tests
Statistical inference: Statistical Power, ANOVA, and Post Hoc testsStatistical inference: Statistical Power, ANOVA, and Post Hoc tests
Statistical inference: Statistical Power, ANOVA, and Post Hoc tests
 
Estimating a Population Proportion
Estimating a Population ProportionEstimating a Population Proportion
Estimating a Population Proportion
 
Estimating a Population Proportion
Estimating a Population ProportionEstimating a Population Proportion
Estimating a Population Proportion
 
Chapter 3
Chapter 3Chapter 3
Chapter 3
 
Introduction-to-Analyzing-Statistical-Data.pdf
Introduction-to-Analyzing-Statistical-Data.pdfIntroduction-to-Analyzing-Statistical-Data.pdf
Introduction-to-Analyzing-Statistical-Data.pdf
 
A Lecture on Sample Size and Statistical Inference for Health Researchers
A Lecture on Sample Size and Statistical Inference for Health ResearchersA Lecture on Sample Size and Statistical Inference for Health Researchers
A Lecture on Sample Size and Statistical Inference for Health Researchers
 
Sampling Size
Sampling SizeSampling Size
Sampling Size
 
RMH Concise Revision Guide - the Basics of EBM
RMH Concise Revision Guide -  the Basics of EBMRMH Concise Revision Guide -  the Basics of EBM
RMH Concise Revision Guide - the Basics of EBM
 
M.Ed Tcs 2 seminar ppt npc to submit
M.Ed Tcs 2 seminar ppt npc   to submitM.Ed Tcs 2 seminar ppt npc   to submit
M.Ed Tcs 2 seminar ppt npc to submit
 
Answer the questions in one paragraph 4-5 sentences. · Why did t.docx
Answer the questions in one paragraph 4-5 sentences. · Why did t.docxAnswer the questions in one paragraph 4-5 sentences. · Why did t.docx
Answer the questions in one paragraph 4-5 sentences. · Why did t.docx
 
Chapter09
Chapter09Chapter09
Chapter09
 
just to download
just to downloadjust to download
just to download
 

More from Eugene Yan Ziyou

System design for recommendations and search
System design for recommendations and searchSystem design for recommendations and search
System design for recommendations and searchEugene Yan Ziyou
 
Recommender Systems: Beyond the user-item matrix
Recommender Systems: Beyond the user-item matrixRecommender Systems: Beyond the user-item matrix
Recommender Systems: Beyond the user-item matrixEugene Yan Ziyou
 
Predicting Hospital Bills at Pre-admission
Predicting Hospital Bills at Pre-admissionPredicting Hospital Bills at Pre-admission
Predicting Hospital Bills at Pre-admissionEugene Yan Ziyou
 
OLX Group Prod Tech 2019 Keynote: Asia's Tech Giants
OLX Group Prod Tech 2019 Keynote: Asia's Tech GiantsOLX Group Prod Tech 2019 Keynote: Asia's Tech Giants
OLX Group Prod Tech 2019 Keynote: Asia's Tech GiantsEugene Yan Ziyou
 
Data Science Challenges and Impact at Lazada (Big Data and Analytics Innovati...
Data Science Challenges and Impact at Lazada (Big Data and Analytics Innovati...Data Science Challenges and Impact at Lazada (Big Data and Analytics Innovati...
Data Science Challenges and Impact at Lazada (Big Data and Analytics Innovati...Eugene Yan Ziyou
 
INSEAD Sharing on Lazada Data Science and my Journey
INSEAD Sharing on Lazada Data Science and my JourneyINSEAD Sharing on Lazada Data Science and my Journey
INSEAD Sharing on Lazada Data Science and my JourneyEugene Yan Ziyou
 
SMU BIA Sharing on Data Science
SMU BIA Sharing on Data ScienceSMU BIA Sharing on Data Science
SMU BIA Sharing on Data ScienceEugene Yan Ziyou
 
Culture at Lazada Data Science
Culture at Lazada Data ScienceCulture at Lazada Data Science
Culture at Lazada Data ScienceEugene Yan Ziyou
 
Competition Improves Performance: Only when Competition Form matches Goal Ori...
Competition Improves Performance: Only when Competition Form matches Goal Ori...Competition Improves Performance: Only when Competition Form matches Goal Ori...
Competition Improves Performance: Only when Competition Form matches Goal Ori...Eugene Yan Ziyou
 
How Lazada ranks products to improve customer experience and conversion
How Lazada ranks products to improve customer experience and conversionHow Lazada ranks products to improve customer experience and conversion
How Lazada ranks products to improve customer experience and conversionEugene Yan Ziyou
 
Sharing about my data science journey and what I do at Lazada
Sharing about my data science journey and what I do at LazadaSharing about my data science journey and what I do at Lazada
Sharing about my data science journey and what I do at LazadaEugene Yan Ziyou
 
AXA x DSSG Meetup Sharing (Feb 2016)
AXA x DSSG Meetup Sharing (Feb 2016)AXA x DSSG Meetup Sharing (Feb 2016)
AXA x DSSG Meetup Sharing (Feb 2016)Eugene Yan Ziyou
 
Garuda Robotics x DataScience SG Meetup (Sep 2015)
Garuda Robotics x DataScience SG Meetup (Sep 2015)Garuda Robotics x DataScience SG Meetup (Sep 2015)
Garuda Robotics x DataScience SG Meetup (Sep 2015)Eugene Yan Ziyou
 
DataKind SG sharing of our first DataDive
DataKind SG sharing of our first DataDiveDataKind SG sharing of our first DataDive
DataKind SG sharing of our first DataDiveEugene Yan Ziyou
 
Social network analysis and growth recommendations for DataScience SG community
Social network analysis and growth recommendations for DataScience SG communitySocial network analysis and growth recommendations for DataScience SG community
Social network analysis and growth recommendations for DataScience SG communityEugene Yan Ziyou
 
Kaggle Otto Challenge: How we achieved 85th out of 3,514 and what we learnt
Kaggle Otto Challenge: How we achieved 85th out of 3,514 and what we learntKaggle Otto Challenge: How we achieved 85th out of 3,514 and what we learnt
Kaggle Otto Challenge: How we achieved 85th out of 3,514 and what we learntEugene Yan Ziyou
 
Nielsen x DataScience SG Meetup (Apr 2015)
Nielsen x DataScience SG Meetup (Apr 2015)Nielsen x DataScience SG Meetup (Apr 2015)
Nielsen x DataScience SG Meetup (Apr 2015)Eugene Yan Ziyou
 
Statistical inference: Probability and Distribution
Statistical inference: Probability and DistributionStatistical inference: Probability and Distribution
Statistical inference: Probability and DistributionEugene Yan Ziyou
 
A Study on the Relationship between Education and Income in the US
A Study on the Relationship between Education and Income in the USA Study on the Relationship between Education and Income in the US
A Study on the Relationship between Education and Income in the USEugene Yan Ziyou
 
Diving into Twitter data on consumer electronic brands
Diving into Twitter data on consumer electronic brandsDiving into Twitter data on consumer electronic brands
Diving into Twitter data on consumer electronic brandsEugene Yan Ziyou
 

More from Eugene Yan Ziyou (20)

System design for recommendations and search
System design for recommendations and searchSystem design for recommendations and search
System design for recommendations and search
 
Recommender Systems: Beyond the user-item matrix
Recommender Systems: Beyond the user-item matrixRecommender Systems: Beyond the user-item matrix
Recommender Systems: Beyond the user-item matrix
 
Predicting Hospital Bills at Pre-admission
Predicting Hospital Bills at Pre-admissionPredicting Hospital Bills at Pre-admission
Predicting Hospital Bills at Pre-admission
 
OLX Group Prod Tech 2019 Keynote: Asia's Tech Giants
OLX Group Prod Tech 2019 Keynote: Asia's Tech GiantsOLX Group Prod Tech 2019 Keynote: Asia's Tech Giants
OLX Group Prod Tech 2019 Keynote: Asia's Tech Giants
 
Data Science Challenges and Impact at Lazada (Big Data and Analytics Innovati...
Data Science Challenges and Impact at Lazada (Big Data and Analytics Innovati...Data Science Challenges and Impact at Lazada (Big Data and Analytics Innovati...
Data Science Challenges and Impact at Lazada (Big Data and Analytics Innovati...
 
INSEAD Sharing on Lazada Data Science and my Journey
INSEAD Sharing on Lazada Data Science and my JourneyINSEAD Sharing on Lazada Data Science and my Journey
INSEAD Sharing on Lazada Data Science and my Journey
 
SMU BIA Sharing on Data Science
SMU BIA Sharing on Data ScienceSMU BIA Sharing on Data Science
SMU BIA Sharing on Data Science
 
Culture at Lazada Data Science
Culture at Lazada Data ScienceCulture at Lazada Data Science
Culture at Lazada Data Science
 
Competition Improves Performance: Only when Competition Form matches Goal Ori...
Competition Improves Performance: Only when Competition Form matches Goal Ori...Competition Improves Performance: Only when Competition Form matches Goal Ori...
Competition Improves Performance: Only when Competition Form matches Goal Ori...
 
How Lazada ranks products to improve customer experience and conversion
How Lazada ranks products to improve customer experience and conversionHow Lazada ranks products to improve customer experience and conversion
How Lazada ranks products to improve customer experience and conversion
 
Sharing about my data science journey and what I do at Lazada
Sharing about my data science journey and what I do at LazadaSharing about my data science journey and what I do at Lazada
Sharing about my data science journey and what I do at Lazada
 
AXA x DSSG Meetup Sharing (Feb 2016)
AXA x DSSG Meetup Sharing (Feb 2016)AXA x DSSG Meetup Sharing (Feb 2016)
AXA x DSSG Meetup Sharing (Feb 2016)
 
Garuda Robotics x DataScience SG Meetup (Sep 2015)
Garuda Robotics x DataScience SG Meetup (Sep 2015)Garuda Robotics x DataScience SG Meetup (Sep 2015)
Garuda Robotics x DataScience SG Meetup (Sep 2015)
 
DataKind SG sharing of our first DataDive
DataKind SG sharing of our first DataDiveDataKind SG sharing of our first DataDive
DataKind SG sharing of our first DataDive
 
Social network analysis and growth recommendations for DataScience SG community
Social network analysis and growth recommendations for DataScience SG communitySocial network analysis and growth recommendations for DataScience SG community
Social network analysis and growth recommendations for DataScience SG community
 
Kaggle Otto Challenge: How we achieved 85th out of 3,514 and what we learnt
Kaggle Otto Challenge: How we achieved 85th out of 3,514 and what we learntKaggle Otto Challenge: How we achieved 85th out of 3,514 and what we learnt
Kaggle Otto Challenge: How we achieved 85th out of 3,514 and what we learnt
 
Nielsen x DataScience SG Meetup (Apr 2015)
Nielsen x DataScience SG Meetup (Apr 2015)Nielsen x DataScience SG Meetup (Apr 2015)
Nielsen x DataScience SG Meetup (Apr 2015)
 
Statistical inference: Probability and Distribution
Statistical inference: Probability and DistributionStatistical inference: Probability and Distribution
Statistical inference: Probability and Distribution
 
A Study on the Relationship between Education and Income in the US
A Study on the Relationship between Education and Income in the USA Study on the Relationship between Education and Income in the US
A Study on the Relationship between Education and Income in the US
 
Diving into Twitter data on consumer electronic brands
Diving into Twitter data on consumer electronic brandsDiving into Twitter data on consumer electronic brands
Diving into Twitter data on consumer electronic brands
 

Recently uploaded

2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...Nguyen Thanh Tu Collection
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Pooja Bhuva
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024Elizabeth Walsh
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfDr Vijay Vishwakarma
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Pooja Bhuva
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxPooja Bhuva
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17Celine George
 

Recently uploaded (20)

2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 

Statistical inference: Hypothesis Testing and t-tests

  • 1. Statistical Inference Week 3: Hypothesis Testing and t-tests
  • 2. Central Limit Theorem  What is the mean height (𝜇) of all primary school children in Singapore? Sample = Anderson Primary Population = All primary school children in SG Sample = Damai Primary Sample = Red Swastika Primary Sample = Zhenghua Primary 𝒙 𝑨𝒏𝒅𝒆𝒓𝒔𝒐𝒏 𝑷𝒓𝒊𝒎𝒂𝒓𝒚 = Mean height of 100 children from Anderson Primary 𝒙 𝑫𝒂𝒎𝒂𝒊 𝑷𝒓𝒊𝒎𝒂𝒓𝒚 = Mean height of 100 children from Damai Primary 𝒙 𝑹𝒆𝒅 𝑺𝒘𝒂𝒔𝒕𝒊𝒌𝒂 = Mean height of 100 children from Red Swastika Primary 𝒙 𝒁𝒉𝒆𝒏𝒈𝒉𝒖𝒂 𝑷𝒓𝒊𝒎𝒂𝒓𝒚= Mean height of 100 children from Zhenghua Primary 𝐷𝑖𝑠𝑡𝑟𝑖𝑏𝑢𝑡𝑖𝑜𝑛 𝑜𝑓 𝑚𝑒𝑎𝑛 ℎ𝑒𝑖𝑔ℎ𝑡 ~ 𝑁(𝑚𝑒𝑎𝑛 = 𝜇, 𝑠𝑡𝑎𝑛𝑑𝑎𝑟𝑑 𝑒𝑟𝑟𝑜𝑟 = 𝜎 100 ) … … … From the sampling distribution:  Mean( 𝑥) ≈ 𝜇  SD( 𝑥) < 𝜎 − As sample size increases, SD decreases
  • 3. Central Limit Theorem (CLT)  The distribution of sample statistics (e.g., mean) is approximately normal, regardless of the underlying distribution, with mean = 𝜇 and variance = 𝜎2 𝑁 𝒙 ~ 𝑵(𝒎𝒆𝒂𝒏 = 𝝁, 𝒔𝒕𝒂𝒏𝒅𝒂𝒓𝒅 𝒆𝒓𝒓𝒐𝒓 = 𝝈 𝒏 )  Further experimentation: http://bitly.com/clt_mean Distribution is normal Sample mean = population mean Sample sd = population sd divided by square root of sample size Applet source: Mine Çetinkaya-Rundel, Duke University
  • 4. Conditions for CLT  Independence: Sampled observations must be independent: − Random sample/assignment − If sampling without replacement, n < 10% of population  Sample Size/Skew: − Population should be normal − If not, sample size should be large (rule of thumb: n > 30)
  • 5. Confidence Interval  An interval estimate of a population parameter − Computed as sample mean +/- a margin of error 𝑥 ± 𝑧 × 𝑆𝐸, where SE = 𝑠 𝑛 − 95% confidence interval would contain 95% of all values and would be 𝑥 ± 2𝑆𝐸 or 𝑥 ± 1.96 × 𝑠 𝑛 𝑪𝑳𝑻: 𝒙 ~ 𝑵(𝒎𝒆𝒂𝒏 = 𝝁, 𝒔𝒕𝒂𝒏𝒅𝒂𝒓𝒅 𝒆𝒓𝒓𝒐𝒓 = 𝝈 𝒏 )
  • 6. Confidence Interval  You have taken a random sample of 100 primary school children in Singapore. Their heights had mean = 150cm and sd = 10cm. Estimate the true average height of primary school children based on this sample using a 95% confidence interval.  We are 95% confident that primary school children mean height is between 148.04cm and 151.96cm Confidence Interval: 𝑥 ± 𝑧 × 𝑆𝐸 𝑛 = 100 𝑥 = 150 𝑠𝑑 = 10 𝑆𝐸 = 𝑠𝑑 𝑛 = 10 100 = 1 𝑥 ± 𝑧 × 𝑆𝐸 = 150 ± 1.96 × 1 = 150 ± 1.96 = (148.04, 151.96)
  • 7. Required sample size for margin of error  Given a target margin of error and confidence level, and information on the standard deviation of sample (or population), we can work backwards to determine the required sample size.  Previous measurements of primary school children heights show sd = 15cm. What should be the sample size in order to get a 95% confidence interval with a margin of error less than or equal 1cm? Margin of error: ≤ 1𝑐𝑚 Confidence level: 95% 𝑧 = 1.96 𝑠𝑑 = 15 𝑀𝐸 = 𝑧 × 𝑆𝐸 1 = 1.96 × 15 𝑛 𝑛 = ( 1.96 × 15 1 )2 𝑛 = (29.4)2 = 864.36 Thus, we need a sample size of at least 865 primary school children
  • 8. Hypothesis Testing  Null hypothesis 𝐻0 − The status quo that is assumed to be true  Alternative hypothesis (𝐻 𝑎) − An alternative claim under consideration that will require statistical evidence to accept, and thus, reject the null hypothesis  We will consider 𝐻0 to be true and accept it unless the evidence in favour of 𝐻 𝑎 is so strong that we reject 𝐻0 in favour of 𝐻 𝑎.
  • 9. Hypothesis Testing  Earlier, we found the sample of 100 primary school children had mean height = 150cm and sd = 10cm. Based on this statistic, does the data support the hypothesis that primary school children on average are shorter than 151cm? 𝐻0: μ = 151 #primary school students have mean height = 151 𝐻 𝑎: 𝜇 < 151 #primary school students have mean height < 151
  • 10. P-value  Probability of obtaining the observed result or results that are more “extreme”, given that the null hypothesis is true − P(observed or more extreme outcome | 𝐻0 is true) − If the p-value is low (i.e., lower than the significance level (𝛼), usually 5%), then we say that it is very unlikely to observe the data if the null hypothesis was true, and reject 𝐻0 − If the p-value is high (i.e., higher than 𝛼), we say that it is likely to observe the data even if the null hypothesis was true, and thus do not reject 𝐻0
  • 11. Hypothesis Testing and P-value  Recall that the sample of 100 primary school children had mean height = 150cm and sd = 10cm. Also take sig. level = 0.05 𝑥 = 150cm; sd = 10cm; SE = 10 100 = 1 #what we know from the sample 𝑋 ~𝑁(𝜇 = 151, 𝑆𝐸 = 1) #null hypothesis of the population Test Statistic: 𝑍 = 150 − 151 1 = −1 P-value: 𝑃 𝑍 < −1 = 1 − 0.8413 = 0.1587 Since p-value is higher than 0.05, we do not reject 𝐻0
  • 12. 𝜇 = 151150 0.1587 Hypothesis Testing and P-value  Interpreting p-value − If in fact, primary school children have mean height of 151cm, there is a 15.9% chance that a random sample of 100 children would yield a sample mean of 150cm or lower − This is a pretty high probability − Thus, the sample mean of 150 could have likely occurred by chance
  • 13. Two-sided Hypothesis Testing  What is the probability that the children have mean height different from 151cm? 𝐻0: μ = 151 #primary school students have mean height = 151 𝐻 𝑎: 𝜇 ≠ 151 #primary school students have mean height ≠ 151 P-value: 𝑃 𝑍 < −1 + 𝑃 𝑍 > 1 = 2 × 1 − 0.8413 = 0.3174 𝜇 = 151150 0.1587 0.1587 152
  • 14. Hypothesis Testing and Confidence Intervals  If the confidence interval contains the null value, don’t reject 𝐻0. If the confidence interval does not contain the null value, reject 𝐻0. − Previously, we found the 95% confidence interval for heights of primary school children to be (148, 152). Given that our null hypothesis(𝐻0 = 151cm) falls within this 95% CI, we do not reject it.  A two-sided hypothesis with significance level 𝛼 is equivalent to a confidence interval with 𝐶𝐿 = 1 − 𝛼  A one-sided hypothesis with a significance level 𝛼 is equivalent to a confidence interval with 𝐶𝐿 = 1 − 2𝛼 148 cm 152 cm 95% confident that the average height is between 148 and 152 cm
  • 15. Decision Errors  Which error is worse to commit (in a research/business context)? − Type II: Declaring the defendant innocent when they are actually guilty − Type I: Declaring the defendant guilty when they are actually innocent “Better that ten guilty persons escape than that one innocent suffer” - William Blackstone Fail to reject 𝐻0 Reject 𝐻0 𝐻0 is True  Type I error 𝐻0 is False Type II error 
  • 16. Type I Error rate  We reject 𝐻0 when the p-value is less than 0.05 (𝛼=0.05) − I.e., Should 𝐻0 actually be true, we do not want to incorrectly reject it more than 5% of the time − Thus, using a 0.05 significance level is equivalent to having a 5% chance of making a Type I error  Choosing significance levels − If Type I Error is costly, we choose a lower significance level (e.g., 0.01) − E.g., spam filtering − If Type II Error is costly, we choose a higher significance level (e.g., 0.10) − E.g., airport baggage screening Fail to reject 𝐻0 Reject 𝐻0 𝐻0 is True  Type I error (𝛼) 𝐻0 is False Type II error (𝛽) 
  • 17. Student’s t Distribution  According to CLT, the distribution of sample statistics is approximately normal, if: − Population is normal − Sample size is large (n > 30)  If so, we can use the population sd (𝜎) to compute a z-score  However, sample sizes are sometimes small and we often do not know the standard deviation of the population (𝜎) − Thus, the normal distribution may not be appropriate  Thus, we rely on the t distribution
  • 18. Shape of the t distribution  Bell shaped but thicker tails than the normal − Thus, observations are more likely to fall beyond 2sd from the mean − The thicker tails are helpful in adjusting for the less reliable data on the standard deviation (when n is small and/or 𝜎 is unknown)
  • 19. Shape of the t distribution  Has one parameter, degrees of freedom (df), which determines the thickness of the tails − df refers to the number of independent observations in data set − Number of independent observations = sample size minus 1 − E.g., in a sample size of 8, there are (8-1) degrees of freedom  What happens to the shape of the t distribution when df increases? − It approaches the normal distribution
  • 20. When to use the t distribution  In general, we use the t distribution when: − N is small (n < 30) and/or; − 𝜎 is unknown  However, nowadays, our sample sizes are usually above 30 − Thus, why bother with the t distribution? − Because 95% of the world prefers the t distribution to the normal and you’ll definitely encounter it eventually − If you’re unsure, use the t distribution since it approximates to the normal distribution with large sample sizes
  • 21. Independent and Dependent t-tests  When to use independent and dependent t-tests? − Dependent: when evaluating the effect between two related samples − You feed a group of 100 people fast food everyday − Did they gain weight after 30 days? − Independent: when evaluating the effect between two independent samples − You feed 50 males and 50 females fast food everyday − Did males or females gain more weight after 30 days?  You conduct a study with two groups and have them exercise three times a day for 30 days (group A = crossfit, group B = yoga). − How would you test the difference between crossfit and yoga participants? − How would you test the difference in weight between day 0 and day 30 for yoga participants?
  • 22. Effect Size  When samples become large enough, you often get significant results − However, is it practically significant?  Effect size is a simple way to quantify difference between two groups − Emphasizes the size of the difference (without effect of sample size) − Cohen’s d is one of the most common ways to measure effect size Effect size: Proper calculation for 𝑆𝐷 𝑝𝑜𝑜𝑙𝑒𝑑: Simple calculation for 𝑆𝐷 𝑝𝑜𝑜𝑙𝑒𝑑:
  • 23. Time for practice  In this lab session we will cover: − Independent t-tests − Dependent (paired) t-tests − Effect size (Cohen’s d)  GitHub repository: https://github.com/eugeneyan/Statistical-Inference
  • 24. Thank you for your attention! Eugene Yan