Download One-sample t test

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
no text concepts found
Transcript
http://cc.jlu.edu.cn/ms.html
Medical Statistics
7
Tao Yuchun
1
2014.3.18
Statistical inference
3. t test and Z test
2
2014.3.18
3.1 t test
(1) Comparing to a given population mean
(One-sample t test)
• See Example 6-1 and Example 6-2 in last class.
( see 2014MedicalStatistics6.ppt)
• The formula of the test statistic for one-sample
t test is:
X 
t
~ t ( )
  n 1
S
n
• here μ is a given population mean.
3
2014.3.18
• One-sample t test is also called the t test for one
group of data under completely randomized
design.
•Question: What is completely randomized
design?
• Design for the individuals to be observed are
completely randomly selected from the
population.
4
2014.3.18
(2) Comparison for Paired Data
(Paired-Samples t test)
• Paired-Samples t test is also called the t test for
data under randomized paired design.
•Question: What is randomized paired
design?
• Design for the similar individuals in terms of
several important features are paired and two
individuals of any pair are randomly assigned
to receive two treatments respectively.
5
2014.3.18
•Example 7-1:
8 patients with hypertension were
treated with a medicine and the Diastolic Blood Pressure
(DBP) was measured before and after the treatment.
Comparing the effects of the medicine on decreasing
DBP. Data list in the table below.
DBP variation before and after treatment
No.
Before
After
Difference
1
96
88
8
2
112
108
4
3
108
102
6
4
102
98
4
5
98
100
-2
6
100
96
4
7
106
102
4
8
100
92
8
Total
36
6
2014.3.18
H 0 : d  0
•You can see “exp7-1.xls”.
H1 :  d  0
  0.05
36
d i2  (di ) 2 / n
232  362 / 8
d
 4.5 S d 

 3.16
8
n 1
8 1
d 0
4.50
t

 4.02
sd / n 3.16 / 8
t > t0.05,7=2.365, P < 0.05, H0 is rejected at significance
level α=0.05. The medicine can be thought as effectiveness,
it can reduce DBP.
7
2014.3.18
• The formula of the test statistic for pairedsample t test is:
d 0
t
~ t ( )
Sd
n
  n 1
• here d and Sd refer to the mean and SD of the variable “difference”.
8
2014.3.18
(3) Comparison between two sample
means (Independent-Samples t test)
• Independent-Samples t test is also called the t
test for comparing two means based on two
groups of data under completely randomized
design.
•Example 7-2: Two groups of rats were fed by
different food. One contains high protein, another
contains low protein. Comparing the effects of
different food on increasing weight. Data list in the
table sees next page.
9
2014.3.18
Comparing the effects of different food on increasing weight for two groups of rats
High Protein
134
146
104
119
124
161
107
low Protein
70
118
101
85
107
132
94
83
113
129
97
123
H 0 : 1  2
H1 : 1  2
  0.05
2
S
• First, you should calculate the c (called pooled
estimation of sample variance):
2
2
(
n

1
)
S

(
n

1
)
S
1
2
2
Sc2  1
n1  n2  2
10
2014.3.18
sc2 

2
2
(
X

X
)

(
X

X
)
 1 1  2 2
n1  n2  2
2
2
2
2
X

(
X
)
/
n

X

(
X
)
 1  1
 2  2 / n2
1
n1  n2  2
2
2
177832

1440
/
12

73959

707
/7
sc2 
 446.12
12  7  2
1
1
1
1
s X 1  X x  sc2 ( 
)  446.12(
 )  10.05
n1 n2
12 7
X 1  X 2 120  101
t

 1.891
s X1  X 2
10.05
•You can see “exp7-2.xls”.
11
2014.3.18
υ=n1+n2-2=12+7-2=17
Checked two sides tα,ν= t0.05,17=2.110, now
t=1.891<2.110, then P>0.05, the null hypothesis is
not rejected at the significance level α=0.05. There
is not different for the population mean of increasing
weight between two groups of rats fed different food
containing different protein.
12
2014.3.18
The formula of the test statistic for independentsamples t test is:
2
2
(
n

1
)
S

(
n

1
)
S
1
2
2
Sc2  1
n1  n2  2
n1

n2
2
(
X

X
)

(
X

X
)
 1i 1  2i 2
t
2
i 1
i 1
n1  n2  2
X1  X 2
S X1  X 2

X1  X 2
S c2 (
1 1
 )
n1 n2
• here Sc2 is pooled estimation of sample variance.
• This t test is for assumption of the variances
of two populations being equal.
13
2014.3.18
 The t test is a statistical method for comparing
differences between two groups.
• The t test requires a continuous dependent
variable on which the groups are being
compared.
• The t test assumes that the variable is normally
distributed in the populations from which the
samples are drawn and that the samples have
equivalent variances.
 The t test is particularly useful in experimental and
quasi-experimental designs in which an experimental
and a control group are compared.
14
2014.3.18
•Question: How do I draw a conclusion
by any t test ?
• If t ≥tα,ν , then P ≤α,reject H0 at
significance levelα=0.05.
• If t <tα,ν , then P >α,accept H0 at
significance levelα=0.05.
• You can find tα,ν in Student’s t table !
You may also use
Excel’s function tinv(α,ν)
to get it. Remember it
for
Two-sided ! One-sided
just use tinv(2α,ν) !
15
2014.3.18
3.2 Z test
(1) Comparing to a given population mean
for a big sample (One-sample Z test)
• The formula of the test statistic for one-sample
Z test is:
Z
X 
~ Z _ distribution
S
n
• Z distribution is N(0,1).
16
2014.3.18
• big means sample size n ≥ 50.
• One-sample Z test is same as one-sample t test in
steps of hypothesis testing, but you need to check
Z limit value instead of tα,ν.
•Two sides:
Z 0.05  1.96, Z 0.01  2.58
•One side:
Z 0.05  1.65, Z 0.01  2.33
• The example omitted.
17
2014.3.18
(2) Comparison between two big sample
means (Two-Samples Z test)
• big means two sample size all n ≥ 50.
•The formula of the test statistic for two-samples
Z test is:
Z
X1  X 2
S X1  X 2

X1  X 2
S X2 1  S X2 2
18

X1  X 2
S12 S 22

n1 n2
2014.3.18
• Two-samples Z test is same as independent-samples
t test in steps of hypothesis testing, but you need to
check Z limit value instead of tα,ν.
•Two sides:
Z 0.05  1.96, Z 0.01  2.58
•One side:
Z 0.05  1.65, Z 0.01  2.33
• The example omitted.
•Question: How do I draw a conclusion
by any Z test ?
19
2014.3.18
• If Z ≥Zα , then P ≤α,reject H0 at
significance levelα=0.05.
• If Z <Zα , then P >α,accept H0 at
significance levelα=0.05.
• Zα in your heart !
I remember it !
Z0.05=1.96, Z0.01=2.58 !
Two-sided !
20
2014.3.18
3.3 Attention for Hypothesis Testing
a. What does P-value mean?
P-value is the area of the tail(s) in the distribution of the
test statistic beyond the value(s) of the test statistic
calculated based on the sample.
• If the null hypothesis is rejected, the probability of
mistake = P-value
-- A smaller P-value implies the better quality of your
rejection.
• If the null hypothesis is not rejected, the bigger P-value
implies the better quality of your acceptation.
21
2014.3.18
b. What does the significance level α mean?
α shows the quality of the inference.
If you reject the null hypothesis, the probability of making
mistake is limited by α .
c. What are type I error and type II error?
• type I error: When H0 is true, but you rejected it.
It denotes with α , the same as the level of a test.
• type II error: When H0 is not true, but you accepted it.
It denotes with β , which is not very easy to get
accurately.
22
2014.3.18
• You
should know Hypothesis Testing is a
very important method in statistics !
(http://en.wikipedia.org/wiki/Forbidden_City)
23
C
2014.3.18
Related documents