Download Part_2a_-_Review

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

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

Document related concepts

Central limit theorem wikipedia , lookup

Transcript
Introduction to Basic Statistical Methods
Part 1: Statistics in a Nutshell
Part 2: Overview of Biostatistics:
“Which Test Do I Use??”
UWHC Scholarly Forum
May 21, 2014
Ismor Fischer, Ph.D.
UW Dept of Statistics
[email protected]
All slides posted at
http://www.stat.wisc.edu/~ifischer/Intro_Stat/UWHC
• Right-cick on
image for full .pdf
article
• Links in article
to access datasets
“Statistical Inference”
POPULATION
Study Question:
Has mean (i.e., average) of X = “Age
at First Birth” of women in the U.S.
changed since 2010 (25.4 yrs old)?
Present Day: Assume X = “Age at First
Birth” follows a normal distribution
(i.e., “bell curve”) in the population.
Population
Distribution
X
“Statistical Inference”
POPULATION
Study Question:
Has mean (i.e., average) of X = “Age
at First Birth” of women in the U.S.
changed since 2010 (25.4 yrs old)?
Present Day: Assume X = “Age at First
Birth” follows a normal distribution
(i.e., “bell curve”) in the population.
Population
Distribution
X
~ The Normal Distribution ~

“population
standard
deviation”

 f ( x) 
 symmetric about its mean
 unimodal (i.e., one peak),
with left and right “tails”
 models many (but not all)
naturally-occurring systems
 useful mathematical
properties…
“population mean”
~ The Normal Distribution ~
“population
standard
deviation”

95%
2.5%
≈2σ
2.5%
≈2σ

 f ( x) 
“population mean”
 symmetric about its mean
 unimodal (i.e., one peak),
with left and right “tails”
 models many (but not all)
naturally-occurring systems
 useful mathematical
properties…
Approximately 95% of the population
values are contained between
 – 2σ and  + 2 σ.
95% is called the confidence level.
5% is called the significance level.
POPULATION
Study Question:
Has “Mean (i.e., average) Age at
First Birth” of women in the U.S.
changed since 2010 (25.4 yrs old)?
“Statistical Inference”
via… “Hypothesis Testing”
Present Day: Assume “Mean Age at
First Birth” follows a normal distribution
(i.e., “bell curve”) in the population.
Population
Distribution

X
H0: pop mean age  = 25.4
(i.e., no change since 2010)
x4
x1
x2
“Null Hypothesis”
 cannot be found with 100% certainty,
x3
x5
… etc…
x400
but can be estimated with high confidence
(e.g., 95%) from sample data.
Sample size n partially depends on the power of
the test, i.e., the desired probability of correctly
rejecting a false null hypothesis ( 80%).
POPULATION
Study Question:
Has “Mean (i.e., average) Age at
First Birth” of women in the U.S.
changed since 2010 (25.4 yrs old)?
“Statistical Inference”
via… “Hypothesis Testing”
Present Day: Assume “Mean Age at
First Birth” follows a normal distribution
(i.e., “bell curve”) in the population.
Population
Distribution

X
H0: pop mean age  = 25.4
(i.e., no change since 2010)
x4
x1
x2
“Null Hypothesis”
sample mean age x  25.6
x3
x
x5
… etc…
x400
x1  x2 
n
 xn
sample variance
( x1  x )2  ( x2  x )2 
s 
n 1
2
 ( xn  x ) 2
POPULATION
Study Question:
Has “Mean (i.e., average) Age at
First Birth” of women in the U.S.
changed since 2010 (25.4 yrs old)?
“Statistical Inference”
via… “Hypothesis Testing”
Present Day: Assume “Mean Age at
First Birth” follows a normal distribution
(i.e., “bell curve”) in the population.
Population
Distribution

 s = 1.6
X
H0: pop mean age  = 25.4
(i.e., no change since 2010)
x4
x1
x2
“Null Hypothesis”
sample mean age x  25.6
x3
x5
… etc…
x400
x
x1  x2 
n
 xn
standard deviation
sample variance
( x1  x ) 2  ( x2  x ) 2 
s
n 1
 ( xn  x ) 2
POPULATION
Study Question:
Has “Mean (i.e., average) Age at
First Birth” of women in the U.S.
changed since 2010 (25.4 yrs old)?
“Statistical Inference”
via… “Hypothesis Testing”
Present Day: Assume “Mean Age at
First Birth” follows a normal distribution
(i.e., “bell curve”) in the population.
Population
Distribution

 s = 1.6
X
The population distribution
of X follows a bell curve,
H : pop mean age  = 25.4
with standard deviation  .0
(i.e., no change since 2010)
x4
x1
x2
“Null Hypothesis”
sample mean age x  25.6
x3
x5
… etc…
x400
x
x1  x2 
n
 xn
Do the data tend to support or refute the null hypothesis?
Is the difference STATISTICALLY SIGNIFICANT, at the 5% level?
POPULATION
Study Question:
Has “Mean (i.e., average) Age at
First Birth” of women in the U.S.
changed since 2010 (25.4 yrs old)?
“Statistical Inference”
via… “Hypothesis Testing”
Present Day: Assume “Mean Age at
First Birth” follows a normal distribution
(i.e., “bell curve”) in the population.
Population
Distribution

 s = 1.6
X
The “sampling distribution”
of X also follows a bell curve,
H : pop mean age  = 25.4
with standard deviation  /0 n.
(i.e., no change since 2010)
x4
x1
x2
“Null Hypothesis”
sample mean age x  25.6
x3
x5
… etc…
x400
x
x1  x2 
n
 xn
Do the data tend to support or refute the null hypothesis?
Is the difference STATISTICALLY SIGNIFICANT, at the 5% level?
POPULATION
Study Question:
Has “Mean (i.e., average) Age at
First Birth” of women in the U.S.
changed since 2010 (25.4 yrs old)?
“Statistical Inference”
via… “Hypothesis Testing”
Present Day: Assume “Mean Age at
First Birth” follows a normal distribution
(i.e., “bell curve”) in the population.
Population
Distribution

 s = 1.6
X
But estimating  by s
introduces an additional layer
H : pop mean age  = 25.4
of “sampling variability.” 0
(i.e., no change since 2010)
x4
x1
x2
“Null Hypothesis”
sample mean age x  25.6
x3
x5
… etc…
x400
x
x1  x2 
n
 xn
Do the data tend to support or refute the null hypothesis?
Is the difference STATISTICALLY SIGNIFICANT, at the 5% level?
POPULATION
Study Question:
Has “Mean (i.e., average) Age at
First Birth” of women in the U.S.
changed since 2010 (25.4 yrs old)?
“Statistical Inference”
via… “Hypothesis Testing”
Present Day: Assume “Mean Age at
First Birth” follows a normal distribution
(i.e., “bell curve”) in the population.
Population
Distribution
x2
 s = 1.6
In order to take this into
X
account, a cousin to the
normal distribution called
H : pop mean age  = 25.4
the “T-distribution” is used0
(i.e., no change since 2010)
instead (Gossett, 1908).
“Null Hypothesis”
x4
x1

sample mean age x  25.6
x3
x5
… etc…
x400
x
x1  x2 
n
 xn
Do the data tend to support or refute the null hypothesis?
Is the difference STATISTICALLY SIGNIFICANT, at the 5% level?
Student’s T-Distribution
… is actually a family of distributions, indexed by
the degrees of freedom df = n – 1, labeled tdf.
“standard”
bell curve:
 = 0,  = 1
tdf
t1
William S. Gossett
(1876 - 1937)
As n gets large, tdf converges to the standard normal
distribution. But the heavier tails mean a wider interval
is needed to capture 95%, especially if n is small.
POPULATION
Study Question:
Has “Mean (i.e., average) Age at
First Birth” of women in the U.S.
changed since 2010 (25.4 yrs old)?
“Statistical Inference”
via… “Hypothesis Testing”
Present Day: Assume “Mean Age at
First Birth” follows a normal distribution
(i.e., “bell curve”) in the population.
Population
Distribution

 s = 1.6
In order to take this into
X
account, a cousin to the
normal distribution called
H : pop mean age  = 25.4
the “T-distribution” is used0
(i.e., no change since 2010)
instead (Gossett, 1908).
“Null Hypothesis”
T-test
x4
x1
x2
sample mean age x  25.6
x3
x5
… etc…
x400
x
x1  x2 
n
 xn
Do the data tend to support or refute the null hypothesis?
Is the difference STATISTICALLY SIGNIFICANT, at the 5% level?
POPULATION
Study Question:
Has “Mean (i.e., average) Age at
First Birth” of women in the U.S.
changed since 2010 (25.4 yrs old)?
“Statistical Inference”
via… “Hypothesis Testing”
Present Day: Assume “Mean Age at
First Birth” follows a normal distribution
(i.e., “bell curve”) in the population.
Population
Distribution

 s = 1.6
X
T-test
H0: pop mean age  = 25.4
(i.e., no change since 2010)
x4
x1
x2
“Null Hypothesis”
sample mean age x  25.6
x3
x5
… etc…
x400
x
x1  x2 
n
 xn
Do the data tend to support or refute the null hypothesis?
Is the difference STATISTICALLY SIGNIFICANT, at the 5% level?
Two main ways to
conduct a formal
hypothesis test:
95% CONFIDENCE INTERVAL FOR µ
 = 25.4
25.44
x = 25.6
25.76
BASED ON OUR SAMPLE DATA, the true value of μ today is between
25.44 and 25.76 years, with 95% “confidence” (…akin to “probability”).
IF H0 is true, then we would expect a random sample mean x that is at least
0.2 years away from  = 25.4 (as ours was), to occur with probability 1.28%.
“P-VALUE” of our sample
Very informally, the p-value of a sample is the probability (hence a
number between 0 and 1) that it “agrees” with the null hypothesis.
Hence a very small p-value indicates strong evidence against the
null hypothesis. The smaller the p-value, the stronger the evidence,
and the more “statistically significant” the finding (e.g., p < .0001).
25.4 25.6
Two main ways to
conduct a formal
95% CONFIDENCE INTERVAL FOR µ
hypothesis
test: CONCLUSIONS:
FORMAL
 The 95% confidence interval corresponding to our sample mean does not
 =value”
25.4 of25.44
x = 25.6
contain the “null
the population mean,
μ = 25.4 years. 25.76
 The
p-value
ourSAMPLE
sample,DATA,
.0128,the
is less
predetermined
α = .05
BASED
ON of
OUR
truethan
valuethe
of μ
today is between
significance
25.44 andlevel.
25.76 years, with 95% “confidence” (…akin to “probability”).
Based on our sample data, we may (moderately) reject the null hypothesis
is true,
expect a alternative
random sample
mean xH that
is at least
H0: IFμ H=0 25.4
in then
favorwe
of would
the two-sided
hypothesis
A: μ ≠ 25.4,
0.2 αyears
from  =level.
25.4 (as ours was), to occur with probability 1.28%.
at the
= .05away
significance
“P-VALUE” of our sample
INTERPRETATION: According to the results of this study, there exists a
statistically significant difference between the mean ages at first birth in
Very
informally,
theatp-value
a sample islevel.
the probability
2010 (25.4 years
old)
and today,
the 5%of
significance
Moreover,(hence
the a
between
0 and suggest
1) that itthat
“agrees”
with the null
hypothesis.
evidence from number
the sample
data would
the population
mean
age
Henceolder
a very
small
p-value
indicates
evidence
against the
today is significantly
than
in 2010,
rather
thanstrong
significantly
younger.
null hypothesis. The smaller the p-value, the stronger the evidence,
and the more “statistically significant” the finding (e.g., p < .0001).
25.4 25.6
Edited R code:
y = rnorm(400, 0, 1)
z = (y - mean(y)) / sd(y)
x = 25.6 + 1.6*z
Generates a normally-distributed random
sample of 400 age values.
sort(round(x, 1))
[1] 19.6 20.2 20.4 20.5 21.2 22.3 22.3 22.4 22.4 22.4 22.6 22.7 22.7 22.7 22.8
[16] 23.0 23.0 23.1 23.1 23.2 23.2 23.2 23.2 23.2 23.3 23.4 23.4 23.4 23.5 23.5
etc...
[391] 28.7 28.7 28.9 29.2 29.3 29.4 29.6 29.7 29.9 30.2
c(mean(x), sd(x))
[1] 25.6
Calculates sample mean and standard deviation.
1.6
t.test(x, mu = 25.4)
One Sample t-test
data: x
t = 2.5, df = 399, p-value = 0.01282
alternative hypothesis: true mean is not equal to 25.4
95 percent confidence interval:
25.44273 25.75727
sample estimates:
mean of x
25.6
POPULATION
Study Question:
Has “Mean (i.e., average) Age at
First Birth” of women in the U.S.
changed since 2010 (25.4 yrs old)?
“Statistical Inference”
via… “Hypothesis Testing”
Present Day: Assume “Mean Age at
First Birth” follows a normal distribution
(i.e., “bell curve”) in the population.
Population
Distribution

X
H0: pop mean age  = 25.4
(i.e., no change since 2010)
x4
x1
x2
x3
x5
… etc…
x400
The reasonableness of the normality
assumption is empirically verifiable, and in
fact formally testable from the sample data.
If violated (e.g., skewed) or inconclusive
(e.g., small sample size), then “distributionfree” nonparametric tests should be used
instead of the T-test…
Examples: Sign Test, Wilcoxon Signed Rank
Test (= Mann-Whitney U Test)