Upload
joan-martin
View
241
Download
3
Embed Size (px)
Citation preview
Hypothesis Testing
A statistical hypothesis is an assumption about a population parameter. This assumption may or may not be true
What’s a hypothesis
http://stattrek.com/Lesson5/HypothesisTesting.aspx?Tutorial=Stat
The Null Hypothesis (H0)Sample observations are resulting purely from
chanceH0 always contains an “equals” statement
The null hypothesis is assumed to be trueWe need strong statistical evidence to reject it
The Alternative Hypothesis (Ha)This is usually what we’re trying to proveEverything that’s not the null hypothesisSample observations are influenced by some
non-random cause
Null and Alternative Hypothesis
For example
Null and Alternative Hypothesis
Null Hypothesis
Alternative Hypothesis
H0: µ=$10 Ha: µ≠$10 µ is $10 or it isn’t
H0: µ≥$10 Ha: µ<$10 µ is at least $10, or it is less
H0: µ≤$10 Ha: µ>$10 µ is no more than $10, or it is more
We want to know if a coin is fair and balance.H0: Probability of each coin toss coming up
heads = 0.5.Ha: Probability of each coin toss coming up
heads ≠ 0.5.Suppose we test this hypothesis by flipping
the coin 50 times.What would we conclude?
Hypothesis
Consider the following hypotheses.The director of a city’s transit system claims
that 35% of the system’s riders consists of senior citizens. In a recent study, researchers found that only 23% of the riders were seniors. Is the director’s claim wrong? (Transit example)
A parts supplier claims that no more than 20% of the parts he delivers are defective. But a random sample of a recent delivery shows that 25% of the parts were defects. Is the suppliers claim wrong? (Parts example)
Introduction
Transit exampleAssertion: 35% of the riders are senior citizensNull hypothesis: H0: π = 0.35
The null hypothesis is identical to the transit manager’s statement since he claimed an exact value for the parameter.
Alternative hypothesis: Ha: π ≠ 0.35If the null is incorrect, the proportion must be
something other than 0.35.
Formulating the Hypotheses
Parts exampleAssertion: Not more than 20% of the parts are
defectiveNull hypothesis: H0: π ≤ 0.20Alternative hypothesis: Ha: > 0.20
Formulating the Hypotheses
1. State the hypothesesNullAlternate
2. Formulate an analysis planHow to use the sample dataSignificance levelTest method
Mean, proportion, difference between means, z-score, t-score, etc.
Hypothesis Testing
3. Analyze sample dataTest statistic = p-value
4. Interpret the result
Hypothesis testing
A research firm claims that 62% of women age 40-49 participate in a 401(k) retirement account.
We want to test this percentage by randomly selecting a group of 300 women.
What are the null and alternative hypotheses?
Null and Alternative Hypothesis - Practice
Type I ErrorA Type I error occurs when the researcher
rejects a null hypothesis when it is true. The probability of committing a Type I error =
the significance level (α).
Type II ErrorA Type II error occurs when the researcher
fails to reject a null hypothesis that is false. The probability of committing a Type II error is
called Beta, and is often denoted by β. The probability of not committing a Type II error is
called the power of the test.
Decision errors
When a robot welder is in adjustment, its mean time to perform a task is 1.325 minutes.
Past experience tells us the standard deviation for the cycle time is 0.0396 minutes.
Using a recent random sample of 80 jobs, the mean cycle time for the welder was 1.3229 minutes.
Do we need to adjust the machine?
2-Tail Test, σ KnownExample
Our company produces light bulbs with a mean life of 1030.0 hours and a standard deviation of 90.0 hours.
We’re approached by a salesman who says he can sell us a process that will extend the life of our bulbs.
We decide to test this product and, using a sample of 40 bulbs, we discover that the mean life for our bulbs using the new process is 1061.6 hours.
Should we invest in this new process?
1-Tail Test, σ KnownPractice
When set properly, a machine produces nails that are 2 inches long with a standard deviation of 0.070 inches.
We took a sample of 35 nails and found that their mean length was 2.025 inches.
Using a significance level of 0.01, is the machine properly adjusted?
Hypothesis Testing - Practice
The p-value is the probability that we would get a test statistic as extreme as the one observed, if the null hypothesis was true.
In practice, all statistical software packages calculate a p-value and return that value as part of the data.
If p-value is ≤ our level of significance, we have evidence to reject H0
p-values
I took a random sample (n=30) from a population with a known standard deviation (σ=1) and a known mean (μ=0)
Experiment
-1.6239 0.3558 1.33541 0.23904 -0.3557 0.03744
-0.08742 -0.6836 -2.03171 0.0539 0.30906 -2.37686
-1.59076 -0.58299 1.71301 -1.58793 0.40806 -0.2797
-0.58236 -1.72333 1.21996 -0.79786 0.77308 1.34005
-1.07465 -1.15515 -0.98725 -1.71128 0.58343 -1.74421
I then used a statistical package (Minitab®) to run a 1-sample z-test. Here are my results:
Experiment
Test of mu = 0 vs not = 0The assumed standard deviation = 1
Variable N Mean StDev SE Mean 95% CI ZC1 30 -0.420281 1.113508 0.182574 ( -0.778120, -0.062442) -2.30
Variable PC1 0.021What happened?
The credit manager of a department store claims that the mean balance for the store’s charge account customers is $410.
An independent auditor selects 18 accounts at random and finds a mean balance of $511.33 and a standard deviation of $183.75.
The population of account balances is assumed to be normally distributed.
Is the credit manager correct?
Testing a Meanσ Unknown
An inventor developed an, energy-efficient lawn mower engine. He claims that the engine will run continuously for 5 hours on one gallon of regular gasoline.
Suppose a simple random sample of 50 engines is tested. The engines run for an average of 295 minutes, with a standard deviation of 20 minutes.
We want to test this claim (α = .05)
Testing a mean
State the hypothesesFormulate an analysis planAnalyze sample dataInterpret results
Process
Bon Air Elementary School has 300 students. The principal of the school thinks that the average IQ of students at Bon Air is at least 110. To prove her point, she administers an IQ test to 20 randomly selected students. Among the sampled students, the average IQ is 108 with a standard deviation of 10. Based on these results, should the principal accept or reject her original hypothesis? Assume a significance level of 0.01.
Testing a mean
State the hypothesesFormulate an analysis planAnalyze sample dataInterpret results
Example two
Two sample t-testThe sampling method for each sample is
simple random samplingThe samples are independent.Each population is at least 20 times larger than
its respective sample.Each sample is drawn from a normal or near-
normal population.
Hypothesis test: Difference between two means
Within a school district, students were randomly assigned to one of two Math teachers - Mrs. Smith and Mrs. Jones. After the assignment, Mrs. Smith had 30 students, and Mrs. Jones had 25 students.
At the end of the year, each class took the same standardized test. Mrs. Smith's students had an average test score of 78, with a standard deviation of 10; and Mrs. Jones' students had an average test score of 85, with a standard deviation of 15.
Can we determine if Mrs. Smith and Mrs. Jones are equally effective teachers. Use a 0.10 level of significance. (Assume that student performance is approximately normal.)
Difference between means
Two-Sample T-Test and CI
Sample N Mean StDev SE Mean 1 30 78.0 10.0 1.8 2 25 85.0 15.0 3.0
Difference = mu (1) - mu (2)Estimate for difference: -7.0090% CI for difference: (-12.91, -1.09)T-Test of difference = 0 (vs not =): T-Value = -1.99 P-Value = 0.053 DF = 40
Minitab output