0% found this document useful (0 votes)
75 views123 pages

002 Probability-and-Statistics-Part-4-Statistics

Let's calculate the standard error: σ = 15 n = 10 SExҧ = σ/√n = 15/√10 = 4.5 Since the sample mean of 104 is within 1 standard error of the population mean of 100, we cannot reject the hypothesis that the sample comes from the general population.

Uploaded by

Selly Mohamed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
75 views123 pages

002 Probability-and-Statistics-Part-4-Statistics

Let's calculate the standard error: σ = 15 n = 10 SExҧ = σ/√n = 15/√10 = 4.5 Since the sample mean of 104 is within 1 standard error of the population mean of 100, we cannot reject the hypothesis that the sample comes from the general population.

Uploaded by

Selly Mohamed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 123

Probability and Statistics

for Business and Data

PART 4 - STATISTICS
Statistics
What is Statistics?

● Statistics is the application of what we


know to what we want to know.
Is the S&P 500 a good model
of the entire U.S. economy?
Does the population of Texas
reflect the entire U.S. population?
Population vs. Sample

● These terms come up again and again


● Population is every member of a group we
want to study
● Sample is a small set of (hopefully) random
members of the population
Parameter vs. Statistic

● A parameter is a characteristic of a
population. Often we want to understand
parameters.
● A statistic is a characteristic of a sample.
Often we apply statistical inferences to the
sample in an attempt to describe the
population.
Variable

● A variable is a characteristic that describes


a member of the sample.

● Variables can be discrete, or continuous


age salary
gender birthplace
Sampling
Sampling

● One of the great benefits of statistical


models is that a reasonably sized (>30)
random sample will almost always reflect
the population.
● The challenge becomes, how do we select
members randomly, and avoid bias?
Sampling Bias

● There are several forms of bias:


Selection Bias
Perhaps the most common, this type of
bias favors those members of a
population who are more inclined and
able to answer polls.
Sampling Bias

Selection Bias
Undercoverage Bias: making too few
observations or omitting entire
segments of a population
Sampling Bias

Selection Bias
Self-selection Bias: people who
volunteer may differ significantly from
those in the population who don’t
Sampling Bias

Selection Bias
Healthy-user Bias: the sample may come
from a healthier segment of the overall
population – people who walk/jog, work
outside, follow healthier behaviors, etc.
Undercoverage Bias

● A hospital survey of employees conducted


during daytime hours
● Neglects to poll
people who work
the night shift.
Self-Selection Bias

● An online survey about a sports team


● Only people who feel
strongly about the
team will answer
the survey.
Healthy-User Bias

● Polling customers at a fruit stand to study a


connection between diet and health.
● Those polled likely
do other things that
have greater impact
on their health.
Sampling Bias

Survivorship Bias
If a population improves over time,
it may be due to lesser members leaving
the population due to death, expulsion,
relocation, etc.
A Classic Puzzle
● At the start of World War I, British soldiers
wore cloth caps.
● The war office
became alarmed
at the high number
of head injuries, so
they issued metal
helmets to all soldiers.
A Classic Puzzle

● They were surprised to find that the


number of head injuries increased with
the use of metal helmets.
● If the intensity of fighting was the same
before and after the change, why should
the number of head injuries increase?
A Classic Puzzle

● Answer: You have to consider all of the data


● Before the switch, many things that gave
head injuries to soldiers wearing metal
helmets would have caused fatalities for
those wearing cloth caps!
Another Survivorship Example

● In World War II, statistician Abraham Wald


worked for America’s Statistical Research
Group (SRG)

Adapted from https://en.wikipedia.org/wiki/Abraham_Wald


Another Survivorship Example

● One problem the SRG worked on was to


examine the distribution of damage to
aircraft by enemy fire
and to advise the best
placement of additional
armor.
Another Survivorship Example

● Common logic was to provide greater


protection to parts that received more
damage.
Another Survivorship Example

● Wald saw it differently – he felt that damage


must be more uniformly distributed and that
aircraft that could
return had been hit in
less vulnerable parts.
Another Survivorship Example

● Wald proposed that the Navy reinforce


the areas where returning aircraft were
undamaged, since those
were areas that, if hit,
would cause the
plane to be lost!
Types of Sampling

● Random
● Stratified Random
● Cluster
Random Sampling

● As its name suggests, random sampling


means every member of a population has
an equal chance of being selected.
● However, since samples are usually much
smaller than populations, there’s a chance
that entire demographics might be missed.
Stratified Random Sampling

● Stratified random sampling ensures that


groups within a population are adequately
represented.
● First, divide the population into segments
based on some characteristic.
● Members cannot belong to two groups at
once.
Stratified Random Sampling

● Next, take random samples from each


group
● The size of each sample is based on
the size of the group relative to the
population.
Stratified Random Sampling Example

● A company wants to conduct a survey of


customer satisfaction
● They can only survey 10% of their customers
● They want to ensure that every age group is
fairly represented
Stratified Random Sampling Example

● The customer breakdown by age group


is as follows:
20-29 30-39 40-49 50+ TOTAL
1400 4450 3200 950 10,000

stratum

strata
Stratified Random Sampling Example

● To obtain a 10% sample,


take 10% from each group:
20-29 30-39 40-49 50+ TOTAL
1400 4450 3200 950 10,000
140 445 320 95 1,000
Clustering

● A third – and often less precise – method of


sampling is clustering
● The idea is to break the population down
into groups and sample a random selection
of groups, or clusters.
● Usually this is done to reduce costs.
Clustering Examples

● A marketing firm sends pollsters to a


handful of neighborhoods
(instead of canvassing an entire city)
● A researcher samples fishing boats
that are in port on a particular day
(also known as convenience sampling)
Central Limit Theorem
Central Limit Theorem

● What makes sampling such a good


statistical tool is the Central Limit Theorem
● Recall that a sample mean often varies
from the population mean.
● The CLT considers a large number of
random sample tests.
Central Limit Theorem

● The CLT states that the mean values


from a group of samples will be normally
distributed about the population mean,
even if the population itself is not normally
distributed.
● That is, 95% of all sample means should fall
within 2𝜎 of the population mean
Central Limit Theorem
Population mean
𝜇 = 3.5
Central Limit Theorem
Population mean
𝑥ҧ 𝑥ҧ 𝜇 = 3.5
𝑥ҧ 𝑥ҧ Sample means vary!
𝑥ҧ 𝑥ҧ
𝑥ҧ 𝑥ҧ 𝑥ҧ 𝑥ҧ

𝑥ҧ 𝑥ҧ 𝑥ҧ 𝑥ҧ

𝑥ҧ 𝑥ҧ 𝑥ҧ 𝑥ҧ 𝑥ҧ 𝑥ҧ
Central Limit Theorem
Population mean
𝑥ҧ 𝑥ҧ 𝜇 = 3.5
𝑥ҧ 𝑥ҧ As we collect multiple samples,
𝑥ҧ 𝑥ҧ each mean will fall somewhere
close to the population mean
𝑥ҧ 𝑥ҧ 𝑥ҧ 𝑥ҧ

𝑥ҧ 𝑥ҧ 𝑥ҧ 𝑥ҧ

𝑥ҧ 𝑥ҧ 𝑥ҧ 𝑥ҧ 𝑥ҧ 𝑥ҧ
Proof of CLT Available on Wikipedia
For those who are curious, the full proof of
the Central Limit Theorem is available at
https://en.wikipedia.org/wiki/Central_limit_theorem
Standard Error
Standard Error

● Let’s quickly review terminology


● Let’s say we have a population of voters
● It is unrealistic to poll the entire population,
so we poll a sample
● We calculate a statistic from that sample
that lets us estimate a parameter of the
population
Standard Error

POPULATION = 10,000
𝑁 = # population members
𝑃 = population parameter
𝜎 = pop. standard deviation
SAMPLE
= 100
𝑛 = # sample members
𝑝Ƹ = sample statistic
𝑆𝐸𝑝ො = standard error of the
sample
Standard Error POPULATION = 10,000

SAMPLE
● If for the population of Australia, = 100

the mean height is 5’9”,


and for our 100-person sample
the mean height is 5’10”,
then
𝑃 = 5′ 9"
𝑝Ƹ = 5′ 10"
𝑆𝐸𝑝ො = 𝑆𝑡𝑎𝑛𝑑𝑎𝑟𝑑 𝐸𝑟𝑟𝑜𝑟 𝑜𝑓 𝑡ℎ𝑒 𝑀𝑒𝑎𝑛
Standard Error of the Mean

● Where the population standard deviation


describes how wide individual values stray
from the population mean,
the Standard Error of the Mean describes
how far a sample mean may stray from the
population mean.
Standard Error of the Mean

● If the population standard deviation 𝜎 is


known, then the sample standard error of
the mean can be calculated as:
𝜎
𝑆𝐸𝑥ҧ =
𝑛
Standard Error Exercise

● An IQ Test is designed to have a mean score


of 100 with a standard deviation of 15 points.
● If a sample of 10 scores
has a mean of 104, can we
assume they come from
the general population?
Standard Error Exercise

● Sample of 10 IQ Test scores:


𝑛 = 10 𝑥 = 104 𝜎 = 15
𝜎 15
𝑆𝐸𝑥ҧ = = = 4.743
𝑛 10
● 68% of 10-item sample means are expected
to fall between 95.257 and 104.743
POPULATION = 10,000

Confidence Intervals SAMPLE


= 100

“We can say with a 𝑁 = # population members


95% confidence level 𝑃 = population parameter
that the population 𝜎 = pop. standard deviation
parameter lies within
a confidence interval
𝑛 = # sample members
of plus-or-minus two
standard errors of the 𝑝Ƹ = sample statistic
sample statistic” 𝑆𝐸𝑝ො = standard error of the
sample
Confidence Intervals

−2𝑆𝐸𝑝ො 𝑝Ƹ 2𝑆𝐸𝑝ො
confidence
interval
P
Point Estimators

● In the above example,


the sample statistic 𝒑
ෝ is a
point estimator of the
population parameter 𝑷.
Hypothesis Testing
Hypothesis Testing

● Hypothesis Testing is the application of


statistical methods to real-world questions.
● We start with an assumption, called the
null hypothesis
● We run an experiment to test this null
hypothesis
Hypothesis Testing

● Based on the results of the experiment,


we either reject or fail to reject the
null hypothesis
● If the null hypothesis is rejected,
then we say the data supports another,
mutually exclusive alternate hypothesis
● We never “PROVE” a hypothesis!
Framing the Hypothesis

● How do we frame the question


that forms our null hypothesis?
● At the start of the experiment,
the null hypothesis is assumed to be true.
● If the data fails to support the
null hypothesis, only then can we
look to an alternative hypothesis
Framing the Hypothesis

If testing something assumed to be true,


the null hypothesis can reflect the assumption:
Claim: “Our product has an average
shipping weight of 3.5kg.”
Null hypothesis: average weight = 3.5kg
Alternate hypothesis: average weight ≠ 3.5kg
Framing the Hypothesis

If testing a claim we want to be true,


but can’t assume, we test its opposite:
Claim: “This prep course improves
test scores.”
Null hypothesis: old scores ≥ new scores
Alternate hypothesis: old scores < new scores
Framing the Hypothesis

The null hypothesis should contain an


equality (=, ≤ ,≥):
average shipping weight = 3.5kg 𝐻0 : 𝜇 = 3.5
The alternate hypothesis should not have
an equality (≠,<,>):
average shipping weight ≠ 3.5kg 𝐻1 : 𝜇 ≠ 3.5
Framing the Hypothesis

The null hypothesis should contain an


equality (=, ≤ ,≥):
old scores ≥ new scores 𝐻0 : 𝜇0 ≥ 𝜇1
The alternate hypothesis should not have
an equality (≠,<,>):
old scores < new scores 𝐻1 : 𝜇0 < 𝜇1
Hypothesis Testing

● So what lets us reject or fail to reject


the null hypothesis?
Hypothesis Testing

● We run an experiment and record the result.


● Assuming our null hypothesis is valid, if the
probability of observing these results
is very small (inside of 0.05) then we reject
the null hypothesis.
● Here 0.05 is our level of significance
𝛼 = 0.05
Hypothesis Testing - Tails

● The level of significance 𝛼 is the area inside


the tail(s) of our null hypothesis.
● If 𝛼 = 0.05 and the alternative hypothesis is
less than the null, then the
𝐻1 : < 𝑛𝑢𝑙𝑙
left-tail of our probability
curve has an area of 0.05
0.05
Hypothesis Testing - Tails

● The level of significance 𝛼 is the area inside


the tail(s) of our null hypothesis.
● If 𝛼 = 0.05 and the alternative hypothesis is
more than the null, then the
𝐻1 : > 𝑛𝑢𝑙𝑙
right-tail of our probability
curve has an area of 0.05
0.05
Hypothesis Testing - Tails

● The level of significance 𝛼 is the area inside


the tail(s) of our null hypothesis.
● If 𝛼 = 0.05 and the alternative hypothesis is
not equal to the null, then the
𝐻1 : ≠ 𝑛𝑢𝑙𝑙
two tails of our probability
curve share an area of 0.05
0.025 0.025
Hypothesis Testing - Tails

● These areas establish our critical values


or Z-scores:

𝐻1 : ≠ 𝑛𝑢𝑙𝑙

𝑍 = −𝟏. 𝟗𝟔 𝑍 = 𝟏. 𝟗𝟔

0.025 0.025
Tests of Mean vs. Proportion

● In the next two lectures, we'll work through


full examples of Hypothesis Testing.
● There are two main types of tests:
● Test of Means
● Test of Proportions
Tests of Mean vs. Proportion

● Each of these two types of tests has their


own test statistic to calculate.
● Let's review the situation for each test
before we work through some examples in
the upcoming lectures.
Tests of Mean vs. Proportion

● Mean
when we look to find an average, or
specific value in a population we are
dealing with means
● Proportion
whenever we say something like "35%" or
“most” we are dealing with proportions
Test Statistics

● When working with means:


𝑥ҧ − 𝜇 assumes we know
𝑍= the population
𝜎/ 𝑛 standard deviation
● When working with proportions:
𝑝Ƹ − 𝑝 𝑝Ƹ − 𝑝
𝑍= =
𝑝∙𝑞 𝑝 ∙ (1 − 𝑝)
𝑛 𝑛
Hypothesis Testing – P-value Test
In a traditional test:
● take the level of significance 𝛼
● use it to determine the critical value
● compare the test statistic to the critical value

In a P-value test:
● take the test statistic
● use it to determine the P-value
● compare the P-value to the
level of significance 𝛼
Hypothesis Testing – P-value Test

“If the P-value is low,


the null must go!”
reject 𝐻0
“If the P-value is high,
the null must fly!”
fail to reject 𝐻0
Testing Example
Exercise #1
Testing Exercise #1 - Mean

● For this next example we’ll work in the


left-hand side of the probability
distribution, with negative z-scores
● We’ll show how to run the hypothesis test
using the traditional method, and then with
the P-value method
Testing Exercise #1 - Mean

● A company is looking to improve 𝜇 = 3.125


their website performance. 𝜎 = 0.700
● Currently pages have a mean load time of
3.125 seconds, with a standard deviation of
0.700 seconds.
● They hire a consulting firm to improve
load times.
Testing Exercise #1 - Mean

● Management wants a 𝜇 = 3.125


99% confidence level 𝜎 = 0.700
𝛼 = 0.01
● A sample run of 40 of the new
𝑛 = 40
pages has a mean load time of 𝑥ҧ = 2.875
2.875 seconds.
● Are these results statistically faster than
before?
Testing Solution #1 - Mean

1. State the 2. State the


null hypothesis: alternative hypothesis:
𝐻0 : 𝜇 ≥ 3.125 𝐻1 : 𝜇 < 3.125

3. Set a level of 4. Determine the test type:


significance:
𝛼 = 0.01
left tail right tail two tail
Testing Solution #1 - Mean

TRADITIONAL METHOD: 𝜇 = 3.125


5. Test Statistic: 𝜎 = 0.700
𝛼 = 0.01
𝑥ҧ − 𝜇 2.875 − 3.125 𝑛 = 40
𝑍= = = −2.259
𝜎/ 𝑛 0.7/ 40 𝑥ҧ = 2.875
6. Critical Value: 𝑍 = −2.259
z-table lookup on 0.01 𝑧 = −2.325 𝑧 = −2.325
Testing Solution #1 - Mean

TRADITIONAL METHOD: 𝜇 = 3.125


7. Fail to Reject the Null Hypothesis 𝜎 = 0.700
𝛼 = 0.01
Since −2.259 > −2.325, the
𝑛 = 40
test statistic falls outside 𝑥ҧ = 2.875
the rejection region 𝑍 = −2.259
We can’t say that the new web 𝑧 = −2.325
pages are statistically faster.
Testing Solution #1 - Mean

P-VALUE METHOD: 𝜇 = 3.125


5. Test Statistic: 𝜎 = 0.700
𝛼 = 0.01
𝑥ҧ − 𝜇 2.875 − 3.125 𝑛 = 40
𝑍= = = −2.259
𝜎/ 𝑛 0.7/ 40 𝑥ҧ = 2.875
6. P-Value: 𝑍 = −2.259
z-table lookup on -2.26 𝑃 = 0.0119 𝑃 = 0.0119
Testing Solution #1 - Mean

P-VALUE METHOD: 𝜇 = 3.125


7. Fail to Reject the Null Hypothesis 𝜎 = 0.700
𝛼 = 0.01
Since 0.0119 > 0.01, the
𝑛 = 40
P-value is greater than the 𝑥ҧ = 2.875
level of significance 𝛼 𝑍 = −2.259
We can’t say that the new web 𝑃 = 0.0119
pages are statistically faster.
Testing Example
Exercise #2
Testing Exercise #2 - Proportion

● A video game company surveys 400


of their customers and finds that 58%
of the sample are teenagers.
● Is it fair to say that most of the company’s
customers are teenagers?
Testing Solution #2 - Proportion

1. Set the null hypothesis: 𝐻0 : 𝑃 ≤ 0.50


2. Set the alternative hypothesis: 𝐻1 : 𝑃 > 0.50
3. Calculate the test statistic:
𝑝Ƹ − 𝑝 0.58 − 0.50 0.08
𝑍= = = = 𝟑. 𝟐
𝑝∙𝑞 0.50(1 − 0.50) 0.025
𝑛 400
Testing Solution #2 - Proportion

4. Set a significance level: 𝛼 = 0.05


5. Decide what type of tail is involved:
𝐻1 : 𝑃 > 0.50 means a right-tail test
6. Look up the critical value:
𝑍 = 𝟏. 𝟔𝟒𝟓
Critical Value = 1.645
Test Statistic = 3.2
Testing Solution #2 - Proportion

7. Based on the sample,


we reject the null hypothesis,
and support the claim that
most customers are teenagers.

Critical Value = 1.645


Test Statistic = 3.2
Testing Solution #2 - Proportion

NOTE: The size of the sample matters!


If we had started with a sample size of
40 instead of 400, our test statistic
would have been only 1.01,
and we would fail to reject
the null hypothesis. Critical Value = 1.645
Test Statistic = 3.2
Type 1 and Type 2 Errors
Type I and Type II Errors

● Often in medical fields (and other scientific


fields) hypothesis testing is used to test
against results where the "truth" is already
known.
● For example, testing a new diagnostic test
for cancer for patients you have already
succesfully diagnosed by other means.
Type I and Type II Errors

● In this situation, you already know if the


Null Hypothesis is True or False.
● In these situations where you already know
the "truth", then you would know its
possible to commit an error with your
results .
Type I and Type II Errors

● This type of analysis is common enough


that these errors already have specific
names:
● Type I Error
● Type II Error
Type I and Type II Errors

● If we reject a null hypothesis that should


have been supported, we’ve committed a
Type I Error
𝑯𝟎 : 𝑇ℎ𝑒𝑟𝑒 𝑖𝑠 𝑛𝑜 𝑓𝑖𝑟𝑒
Pull the fire alarm,
only to find out there
really was no fire.
Type I and Type II Errors

● If we fail to reject a null hypothesis that


should have been rejected we’ve committed
a Type II Error
𝑯𝟎 : 𝑇ℎ𝑒𝑟𝑒 𝑖𝑠 𝑛𝑜 𝑓𝑖𝑟𝑒
Don’t pull the fire
alarm, only to find
there really is a fire.
𝑯𝟎 : 𝑁𝑜𝑡 𝑝𝑟𝑒𝑔𝑛𝑎𝑛𝑡
𝑯𝟏 : 𝐴𝑟𝑒 𝑝𝑟𝑒𝑔𝑛𝑎𝑛𝑡
Student’s T-Distribution
Student’s T-Distribution

● Developed by William Sealy Gossett while


he was working at Guinness Brewery
● Published under the pseudonym “Student”
as Guinness wouldn’t let him use his name.
● Goal was to select the best barley from
small samples, when the population
standard deviation was unknown!
Purpose of a t-test

● Using the t-table, the Student’s t-test


determines if there is a significant
difference between two sets of data
● Due to variance and outliers, it’s not
enough just to compare mean values
● A t-test also considers sample variances
Types of Student’s t-test

● One-sample t-test
Tests the null hypothesis that the
population mean is equal to a specified
value 𝜇 based on a sample mean 𝑥ҧ
Types of Student’s t-test

● Independent two-sample t-test


Tests the null hypothesis that two
sample means 𝑥ҧ1 and 𝑥ҧ2 are equal
Types of Student’s t-test

● Dependent, paired-sample t-test


Used when the samples are dependent:
o one sample has been tested twice

(repeated measurements)
o two samples have been matched or

"paired"
One-Sample Student’s t-test

● Calculate the t-statistic


𝑥ҧ − 𝜇
𝑡=
𝑠/ 𝑛
𝑥ҧ = sample mean
𝜇 = population mean
𝑠 = sample standard error
𝑛 = sample size
One-Sample Student’s t-test

● Compare to a t-score
𝑡 ≶ 𝑡𝑛−1,𝛼

𝑡 = t-statistic
𝑡𝑛−1,𝛼 = t-critical
𝑛 − 1 = degrees of freedom
𝛼 = significance level
Independent Two-Sample t-test

The calculation of the t-statistic differs


slightly for the following scenarios:
o equal sample sizes, equal variance

o unequal sample sizes, equal variance

o equal or unequal sample sizes, unequal

variance
Independent Two-Sample t-test

● Calculate the t-statistic


𝑠𝑖𝑔𝑛𝑎𝑙 𝑑𝑖𝑓𝑓𝑒𝑟𝑒𝑛𝑐𝑒 𝑖𝑛 𝑚𝑒𝑎𝑛𝑠 𝑥1 − 𝑥2
𝑡= = =
𝑛𝑜𝑖𝑠𝑒 𝑠𝑎𝑚𝑝𝑙𝑒 𝑣𝑎𝑟𝑖𝑎𝑏𝑖𝑙𝑖𝑡𝑦 𝑠1 2 𝑠2 2
+
𝑛1 𝑛2
𝑥1 , 𝑥2 = sample means
𝑠1 2 , 𝑠2 2 = sample variances
𝑛1 , 𝑛2 = sample sizes
Independent Two-Sample t-test

● Compare to a t-score Since we have two,


potentially unequal-sized
𝑡 ≶ 𝑡𝑑𝑓,𝛼 samples with different
variances, determining the
degrees of freedom is a
𝑡 = t-statistic little more complicated.
𝑡𝑑𝑓,𝛼 = t-critical
𝑑𝑓 = degrees of freedom
𝛼 = significance level
Degrees of Freedom

● The Satterthwaite Formula:


2
2 2
𝑠1 𝑠2
+
𝑛1 𝑛2
𝑑𝑓 =
1 2 2
𝑠1 1 𝑠22 2
+
𝑛1 − 1 𝑛1 𝑛2 − 1 𝑛2
Degrees of Freedom

● The General Formula:

𝑑𝑓 = 𝑛1 + 𝑛2 − 2
Student’s t-Distribution

● t-Distributions have fatter tails than


normal Z-Distributions

Z-Distribution
t-Distribution
Student’s t-Distribution

● They approach a normal distribution


as the degrees of freedom increase.

Z-Distribution
t-Distribution
Student’s T-Distribution
Example Exercise
Student’s t-test Example

An auto manufacturer has two plants that


produce the same car.
Student’s t-test Example

They are forced to close one of the plants.


Student’s t-test Example

The company wants to know if there’s a


significant difference in production between
the two plants.
Student’s t-test Example
Plant A Plant B
1184 1136
1203 1178
1219 1212
Daily production over the 1238 1193

same 10 days is as follows:


1243 1226
1204 1154
1269 1230
1256 1222
1156 1161
1248 1148
Student’s t-test Example
Plant A Plant B
1184 1136
1203 1178
1219 1212
First compare sample means 1238 1193
1243 1226
ഥ𝑨 − 𝒙
𝒙 ഥ𝑩 = 1222 − 1186 = 𝟑𝟔 1204 1154
From this sample, it looks like 1269
1256
1230
1222
Plant A produces 36 more cars 1156 1161
1248 1148
per day than Plant B x̅ A x̅ B
Mean 1222 1186
Student’s t-test Example
Plant A Plant B
1184 1136
1203 1178
1219 1212
Is 36 more cars enough to say 1238 1193

that the plants are different?


1243 1226
1204 1154
1269 1230
1256 1222
𝐻0 : 𝑋𝐴 ≤ 𝑋𝐵 1156 1161
1248 1148
𝐻1 : 𝑋𝐴 > 𝑋𝐵 x̅A x̅ B
one-tailed test Mean 1222 1186

(10 + 10 − 2) = 18 𝑑𝑒𝑔𝑟𝑒𝑒𝑠 𝑜𝑓 𝑓𝑟𝑒𝑒𝑑𝑜𝑚


Student’s t-test Example
Plant A Plant B
1184 1136
1203 1178
1219 1212
Compute the variance 1238 1193
1243 1226
A (x-1222) (x-1222)2 𝛴 𝑥 − 𝑥ҧ 2
2 1204 1154
1184 -38 1444 𝑠 =
1203 -19 361
𝑛−1 1269 1230
1219 -3 9 1256 1222
(x-1222)2 11232
1238 16 256 1156 1161
1243 21 441 (x-1222)2 1248 1148
1248
1204 9
-18 324 x̅ A x̅ B
1269 47 2209
1256 34 1156 Mean 1222 1186
1156 -66 4356 Variance 1248 1246
1248 26 676
11232
Student’s t-test Example
Plant A Plant B
1184 1136
1203 1178
1219 1212
Compute the t-value 1238 1193
𝑥1 − 𝑥2 1243 1226
= 1204 1154
𝑠1 2 𝑠2 2
+ 1269 1230
𝑛1 𝑛2 1256 1222
36 36 1156 1161
= = 1248 1148
1248 1246 15.792
+ x̅A x̅ B
10 10
Mean 1222 1186
= 𝟐. 𝟐𝟖 Variance 1248 1246
Student’s t-test Example

Look up our critical value from a t-table


a one-tailed test cum. prob t.90 t.95 t.975 t.99 t.995
one-tail 0.10 0.05 0.025 0.01 0.005
95% confidence two-tails 0.20 0.10 0.05 0.02 0.01

18 degrees of 17 1.333 1.740 2.110 2.567 2.898


18 1.330 1.734 2.101 2.552 2.878
freedom 19 1.328 1.729 2.093 2.539 2.861

critical value = 1.734


Student’s t-test Example
Plant A Plant B
1184 1136
1203 1178
1219 1212
Compare our t-value (2.28) to 1238 1193

the critical value (1.734):


1243 1226
1204 1154
1269 1230
2.28 > 1.734 1256 1222
since our computed t-value is 1156 1161
1248 1148
greater than the critical value,
we reject the null hypothesis.
Student’s t-test Example

We believe with 95% confidence that Plant A


produces more cars per day than Plant B.
We decide to
close Plant B.
Student’s t-Test with Excel
Student’s t-Test with Python
>>> from scipy.stats import ttest_ind
>>> a = [1184, 1203, 1219, … 1248]
>>> b = [1136, 1178, 1212, … 1148]
>>> ttest_ind(a,b).statistic
2.2795770510504845
>>> ttest_ind(a,b).pvalue/2
0.017522528133638322
Next Up: ANOVA

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy