Download STATS 8: Introduction to Biostatistics 24pt Hypothesis 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

Psychometrics wikipedia , lookup

History of statistics wikipedia , lookup

Bootstrapping (statistics) wikipedia , lookup

Taylor's law wikipedia , lookup

Foundations of statistics wikipedia , lookup

Resampling (statistics) wikipedia , lookup

Statistical hypothesis testing wikipedia , lookup

Misuse of statistics wikipedia , lookup

Student's t-test wikipedia , lookup

Transcript
STATS 8: Introduction to Biostatistics
Hypothesis Testing
Babak Shahbaba
Department of Statistics, UCI
Hypothesis
• In general, many scientific investigations start by expressing a
hypothesis.
• For example, Mackowiak et al (1992) hypothesized that the
average normal (i.e., for healthy people) body temperature is
less than the widely accepted value of 98.6F .
• If we denote the population mean of normal body temperature
as µ, then we can express this hypothesis as µ < 98.6.
Null and alternative hypotheses
• The null hypothesis usually reflects the “status quo” or
“nothing of interest”.
• In contrast, we refer to our hypothesis (i.e., the hypothesis we
are investigating through a scientific study) as the alternative
hypothesis and denote it as HA .
• For hypothesis testing, we focus on the null hypothesis since it
tends to be simpler.
Null and alternative hypotheses
• Consider the body temperature example, where we want to
examine the null hypothesis H0 : µ = 98.6 against the
alternative hypothesis HA : µ < 98.6.
• To start, suppose that σ 2 = 1 is known.
• Further, suppose that we have randomly selected a sample of
25 healthy people from the population and measured their
body temperature.
Hypothesis testing for the population mean
• To decide whether we should reject the null hypothesis, we
quantify the empirical support (provided by the observed
data) against the null hypothesis using some statistics.
• We use statistics to evaluate our hypotheses.
• We refer to them as test statistics.
• For a statistic to be considered as a test statistic, its sampling
distribution must be fully known (exactly or approximately)
under the null hypothesis.
• We refer to the distribution of test statistics under the null
hypothesis as the null distribution.
Hypothesis testing for the population mean
• To evaluate hypotheses regarding the population mean, we
use the sample mean X̄ as the test statistic.
X̄ ∼ N µ, σ 2 /n .
• For the above example,
X̄ ∼ N µ, 1/25 .
• If the null hypothesis is true, then
X̄ ∼ N 98.6, 1/25 .
Hypothesis testing for the population mean
• In reality, we have one value, x̄, for the sample mean.
• We can use this value to quantify the evidence of departure
from the null hypothesis.
• Suppose that from our sample of 25 people we find that the
sample mean is x̄ = 98.4.
Hypothesis testing for the population mean
• To evaluate the null hypothesis H0 : µ = 98.6 versus the
1.0
0.5
pobs
x
0.0
Density
1.5
2.0
alternative HA : µ < 98.6, we use the lower tail probability of
this value from the null distribution.
98.0
98.5
99.0
X
Observed significance level
• The observed significance level for a test is the probability of
values as or more extreme than the observed value, based on
the null distribution in the direction supporting the alternative
hypothesis.
• This probability is also called the p-value and denoted pobs .
• For the above example,
pobs = P(X̄ ≤ x̄|H0 ),
z-score
• In practice, it is more common to use the standardized version
of the sample mean as our test statistic.
• We know that if a random variable is normally distributed (as
it is the case for X̄ ), subtracting the mean and dividing by
standard deviation creates a new random variable with
standard normal distribution,
Z ∼ N(0, 1).
• We refer to the standardized value of the observed test
statistic as the z-score,
z
=
=
x̄ − µ0
√ ,
σ/ n
98.4 − 98.6
= −1.
0.2
z-test
• We refer to the corresponding hypothesis test of the
population mean as the z-test.
• In a z-test, instead of comparing the observed sample mean x̄
0.4
0.3
0.2
Density
0.1
1.0
0.5
pobs
x
pobs
z
0.0
0.0
Density
1.5
2.0
to the population mean according to the null hypothesis, we
compare the z-score to 0.
98.0
98.5
99.0
X
−4
−2
0
Z
2
4
Interpretation of p-value
• The p-value is the conditional probability of extreme values
(as or more extreme than what has been observed) of the test
statistic assuming that the null hypothesis is true.
• When the p-value is small, say 0.01 for example, it is rare to
find values as extreme as what we have observed (or more so).
• As the p-value increases, it indicates that there is a good
chance to find more extreme values (for the test statistic)
than what has been observed.
• Then, we would be more reluctant to reject the null
hypothesis.
• A common mistake is to regard the p-value as the probability
of null given the observed test statistic: P(H0 |x̄).
One-sided vs. two-sided hypothesis testing
• The alternative hypothesis HA : µ < 98.6 or HA : µ > 98.6 are
called one-sided alternatives.
• For these hypotheses, pobs = P(Z ≤ z) and pobs = P(Z ≥ z)
respectively.
• In contrast, the alternative hypothesis HA : µ 6= 98.6 is
two-sided.
• For the above three alternatives, the null hypothesis is the
same, H0 : µ = 98.6
• In this case, pobs = 2 × P(Z ≥ |z|).
Hypothesis testing using t-tests
• So far, we have assumed that the population variance σ 2 is
known.
• In reality, σ 2 is almost always unknown, and we need to
estimate it from the data.
• As before, we estimate σ 2 using the sample variance S 2 .
• Similar to our approach for finding confidence intervals, we
account for this additional source of uncertainty by using the
t-distribution with n − 1 degrees of freedom instead of the
standard normal distribution.
• The hypothesis testing procedure is then called the t-test.
Hypothesis testing using t-tests
• Using the observed values of X̄ and S, the observed value of
the test statistic is obtained as follows:
t=
x̄ − µ0
√ .
s/ n
• We refer to t as the t-score.
• Then,
if HA : µ < µ0 , pobs = P(T ≤ t),
if HA : µ > µ0 , pobs = P(T ≥ t),
if HA : µ 6= µ0 , pobs = 2 × P T ≥ |t| ,
• Here, T has a t-distribution with n − 1 degrees of freedom,
and t is our observed t-score.
Hypothesis testing for population proportion
• For a binary random variable X with possible values 0 and 1,
we are typically interested in evaluating hypotheses regarding
the population proportion of the outcome of interest, denoted
as X = 1.
• As discussed before, the population proportion is the same as
the population mean for such binary variables.
• So we follow the same procedure as described above.
• More specifically, we use the z-test for hypothesis testing.
Hypothesis testing for population proportion
• Note that we do not use t-test, because for binary random
variable, population variance is σ 2 = µ(1 − µ).
• Therefore, by setting µ = µ0 according to the null hypothesis,
we also specify the population variance as σ 2 = µ0 (1 − µ0 ).
Hypothesis testing for population proportion
• If we assume that the null hypothesis is true, we have
X̄ |H0 ∼ N µ0 , µ0 (1 − µ0 )/n .
• This means that
X̄ − µ0
Z=p
∼ N(0, 1).
µ0 (1 − µ0 )/n
• As a result, we obtain the z-score as follows:
p − µ0
z=p
,
µ0 (1 − µ0 )/n
where p is the sample proportion (mean).