Download Hypothesis (significance) Testing

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
Transcript
Hypothesis (significance) Testing
Using the Binomial Distribution
Hypothesis the idea:
We use random samples to estimate population
parameters –
If we assume that our random sample comes from a
particular background distribution we can test to see if
the result is likely or unlikely, given that distribution
If the test result is very unlikely we may decide that
the data does not come from our background
Distribution
If the test result is likely we will decide that the data
comes from our background distribution
We determine how likely through our significance level
We can answer questions like this
- Is a dice fair ?
(comparing our sample result against the expected result)
-Does a new drug give better results than an old drug ?
(by comparing our sample result against expected result)
-Can you taste the difference between Coke and Pepsi?
(by comparing our sample result against expected result)
IN all the questions this week we will assume a population
from the Binomial Distribution and we will compare our
OBSERVED data VS EXPECTED Data to draw a conclusion
The binomial Distribution
—2 possible outcomes
—Probability of Success Failure does not change during
Trials
—There are a fixed number of trials
—Trials are Independent
Plan of action
We will learn through a question
You should have understood how to use
Binomial tables yesterday if nothing else!!
Question
A six sided dice is thrown 20 times and the
number of sixes recorded.
Only 2 sixes come up. Is the dice loaded?
–The number of sixes is our Discrete Random Variable (X)
–It follows a Binomial because You either get a six or you do not
–The probability of getting a six does not change for each dice roll
X~B(20,p) we can assume that for a proper dice p = 1/6
Now we set up a test to see if our sample fits a
X~B(30,1/6) model
We always write the process formally!!
Step 1 – state Null Hypothesis
Ho : P(6)=1/6
(probability of getting a six is unbiased~ B(20,1/6)
Step 2- state Alternative Hypothesis
H1 : P(6)<1/6
(probability of getting six is less than 1/6 – biased)
Step 3- Decide on a significance level to test at
Given at 5% usually
Step 4 – From Tables ->Find the CRITICAL VALUE of P(X≤Xc) that
CUTS OFF ≤ 5% This is find P(X≤xc) ≤ 0.05
i.e. The lower tail of the distribution - The Critical Value is Xc
Step 5 – Is our Observed value < The critical value
If so Accept H1,
otherwise Accept Ho
This is X-B(20,1/6)
If Ho is true E(X) = np = 20x1/6 = 3.33
We would expect to get around 3 sixes
P(X = r)
r
Binomial Distribution Hypothesis Tester
0.25
0.20
0.15
0.10
0.05
0.00
0
1
Reject H0
2
3
4
5
6
7
Accept H0
From Tables Xc = 0
P(X≤0) = 0.0241
P(X ≤1) = 0.1227
8
9
10
11
12
13
14
15
16
17
18
19
20
r
These are the
outcomes we observed 2
P(X = r)
P(X <= r)
P(X >= r)
0
0.0241
0.0241
1.0000
1
0.0986
0.1227
0.9759
2
0.1919
0.3146
0.8773
3
0.2358
0.5504
0.6854
4
0.2053
0.7557
0.4496
5
0.1345
0.8902
0.2443
6
0.0689
0.9591
0.1098
7
0.0282
0.9873
0.0409
8
0.0094
0.9967
0.0127
9
0.0026
0.9993
0.0033
10
0.0006
0.9999
0.0007
11
0.0001
1.0000
0.0001
12
0.0000
1.0000
0.0000
13
0.0000
1.0000
0.0000
14
0.0000
1.0000
0.0000
15
0.0000
1.0000
0.0000
16
0.0000
1.0000
0.0000
17
0.0000
1.0000
0.0000
18
0.0000
1.0000
0.0000
19
0.0000
1.0000
0.0000
20
0.0000
1.0000
0.0000
Choose nearest result to 0.05 and ≤ 0.05
So............
Conclusion
The observed value is greater than the critical value so do not reject Ho
(The observed value is not significantly different from the expected value)
P(X≤ 1) is >5% so getting a result of 1 six is not unusual enough to reject Ho
WE SAY THERE IS NOT SUFFICIENT EVIDENCE TO SAY THE DICE IS BIASED
This is the expected value
(μ) given X~B(20,1/6)
0
1
2
3
4
5
6
The Observed value
Xc the critical value
7
8
9 10
11 12 13 14 15 16 17 18 19 20
One tailed test looking at the lower end
of the tail
Example II
A drug for curing headaches has been found to be 75% effective
from research
A new drug has been tested on 20 people and 18 have reported that
their headaches have been cured.
The drug company state in their TV advert that their new drug is
better than the old one. Are they justified in saying this?
The drugs could be said to fit a Binomial X~B(20,p)
For the old drug P=0.75, For the new drug the claim is P>0.75
Step 1 – State the NULL Hypothesis
Ho: P=0.75 (Nothing has changed new drug same as old)
Step 2 – State the Alternative Hypothesis
Ho: P>0.75 (New drug has improved cure rate)
This is another one tailed test
But it looks at the other end of the distribution
Ho: P=0.75 (Nothing has changed new drug same
as old)
Ho: P>0.75 (New drug has improved cure rate)
Step 3 – State the significance level
(given as 5% here = 0.05)
Step 4- From tables find the critical value
(cuts off 5% of the tail of the distribution)
That is P(X≥Xc) < 0.05
We rearrange this because our tables only give
P(X≤r)
P(X≥Xc)= 1.0 - P(X≤Xc-1)
so
1.0 - P(X≤Xc-1) < 0.05
Therefore
P(X ≤Xc-1) > 0.95
From Tables
P(X ≤ 17) = 0.9087
P(X ≤ 18) = 0.9757
( This one)
So Xc-1 = 18
Xc = 19 (This is our Critical Value)
r
P(X = r)
P(X <= r)
P(X >= r)
0
0.0000
0.0000
1.0000
1
0.0000
0.0000
1.0000
2
0.0000
0.0000
1.0000
3
0.0000
0.0000
1.0000
4
0.0000
0.0000
1.0000
5
0.0000
0.0000
1.0000
6
0.0000
0.0000
1.0000
7
0.0002
0.0002
1.0000
8
0.0008
0.0009
0.9998
9
0.0030
0.0039
0.9991
10
0.0099
0.0139
0.9961
11
0.0271
0.0409
0.9861
12
0.0609
0.1018
0.9591
13
0.1124
0.2142
0.8982
14
0.1686
0.3828
0.7858
15
0.2023
0.5852
0.6172
16
0.1897
0.7748
0.4148
17
0.1339
0.9087
0.2252
18
0.0669
0.9757
0.0913
19
0.0211
0.9968
0.0243
20
0.0032
1.0000
0.0032
Xc = 19
Binomial Distribution Hypothesis Tester
P(X = r)
0.25
0.20
Critical Value
0.15
Observed value
0.10
E(X) | X~B(20,.75)
0.05
0.00
0
1
2
Reject H0
3
4
5
6
7
8
9 10 11 12 13 14 15 16 17 18 19 20
r
Accept H0
Conclusion :
So we Have No evidence to Reject Ho
There is not enough evidence to say that the new drug is better
0 1
2
3
Expected
value given
Ho
4
5
6
7
8
≤1%
9 10 11 12 13 14 15 16 17 18 19 20
Binomial Hypothesis testing
One tailed tests
These are one tailed tests because H1 is
P<p1
or
P> p1
Write your answers formally....You MUST
1- Write down the Null Hypothesis and Alternative Hypothesis
2- You should state the underlying Distribution on which Ho is based
3- Ho always represents No change ;
H1 always Change
4- The question will give you the Significance level otherwise assume 5%
5 – Calculate the Critical Value
either P(X ≤ Xc) < 0.05 for left tail
OR
P(X ≥ Xc) < 0.05 for Right tail
6- If the Observed value is Not in the Critical region Accept Ho
7 – Write your conclusions clearly in English
Your Turn
Question
Mrs De Silva is running for President. She claims to have
60% of the population voting for her.
She is suspected of overestimating her level of support.
You want to test this, so you take a random sample of 20
people and find that only 9 will vote for Mrs De Silva.
Test at the 5% level that she has overestimated her
support.