Professional Documents
Culture Documents
Chapter5 2
Chapter5 2
1
2
7.1. Two sample tests with numerical data 7.1. Two sample tests with numerical data
Mean 𝑋 𝑋
Comparing two related samples
SD (standard deviation)
Paired-sample z test for the mean difference
Difference -
Paired-sample t test for the mean difference Status Known Known/unknown
3 4
7.1. Two sample tests with numerical data 7.1. Two sample tests with numerical data
7.1.1 Pooled-Variance t Test (Variances Unknown) for two 7.1.1 Pooled-Variance t Test (Variances Unknown)
independent samples Setting up the hypotheses
Assumptions
H0: 1 = 2
Both populations are normally distributed
H1: 1 2
Samples are randomly and independently drawn
Calculate the Pooled Sample Variance as an Estimate of the
Population variances are unknown but assumed equal
Common Population Variance
If both populations are not normal, need large sample
( n1 1) S12 ( n2 1) S 22
sizes S p2
( n1 1) ( n2 1)
S p2 : Pooled sample variance n1 : Size of sample 1
S12 : Variance of sample 1 n2 : Size of sample 2
5
S 22 : Variance of sample 2 6
7.1. Two sample tests with numerical data 7.1. Two sample tests with numerical data
7.1.1 Pooled-Variance t Test (Variances Unknown) p-value or critical value (CV) solution
Compute the sample statistic
(p-Value ( = 0.05/2) -> Reject.
t
X 1 X 2 1 2
1 1
S p2 Hypothesized
df n1 n2 2 n1 n2 difference Reject Reject
S 2
n1 1 S12 n2 1 S 22
=.025
p
n1 1 n2 1
-CV
0 CV Z
7 8
7.1. Two sample tests with numerical data 7.1. Two sample tests with numerical data
7.1.1 Pooled-Variance t Test được tính bằng python 7.1.2 Comparing two independent samples
Different Data Sources
• Unrelated
• Independent
- Sample selected from one population has no effect
or bearing on the sample selected from the other
population
Use the Difference between 2 Sample Means
Use Z Test or Pooled-Variance t Test
Kết luận gì?
9 10
7.1. Two sample tests with numerical data 7.1. Two sample tests with numerical data
7.1.2 Independent Sample Z Test (Variances Known) z test statistic được tính bằng python
Assumptions
• Samples are randomly and independently drawn from
normal distributions
• Population variances are known
Test Statistic
( X 1 X 2 ) ( 1 )
Z
2 2
n1 n2
11 12
7.2. One-way analysis of variance – F Test 7.2. One-way analysis of variance – F Test
Evaluate the difference among the mean responses of more Hypotheses of one-way Anova
two populations H : 1 2 c
0
Assumptions All population means are equal
Samples are randomly and independently drawn
H 1 : N o t a ll i a re th e s a m e
Populations are normally distributed
At least one population mean is different (others may
Populations have equal variances be the same!)
Does not mean that all population means are different
13 14
7.2. One-way analysis of variance – F Test 7.2. One-way analysis of variance – F Test
One-way Anova (treatment effect present) One-way Anova (Partition of Total variation)
H 0 : 1 2 c Total Variation SST
H 1 : N o t a ll i a r e th e s a m e The Null Hypothesis
is NOT True
Variation Due to Variation Due to Random
= Group SSA + Sampling SSW
1 2 3 1 2 3
15 16
7.2. One-way analysis of variance – F Test 7.2. One-way analysis of variance – F Test
X X
c nj
2 2 2
SST (X
j 1 i 1
ij X )2 SST X 11 X 21 X nc c X
X ij : the i -th observation in group j
Response, X
n j : the number of observations in group j
n : the total number of observations in all groups
c : the number of groups
nj
X
c
X
j 1 i 1
ij
17 18
7.2. One-way analysis of variance – F Test 7.2. One-way analysis of variance – F Test
c 2 2 2
SSA
SSA
j 1
n j(X j X )2 M SA
c 1 SSA n1 X1 X n2 X 2 X nc Xc X
Response, X
7.2. One-way analysis of variance – F Test 7.2. One-way analysis of variance – F Test
23 24
7.2. One-way analysis of variance – F Test 7.2. One-way analysis of variance – F Test
0 CV F
CV=Critical values, =
0.05, F=3.89
25 26
7.2. One-way analysis of variance – F Test 7.2. One-way analysis of variance – F Test
One-way anova example – solutions F Test statistic được tính dựa vào python
H 0: 1 = 2 = 3 Test Statistic:
H1: Not All Equal MSA 23.5820
= .05 F 25.
df1= 2 df2 = 12 MSW .9211
Critical Value(s):
= 0.05
0 3.89 F
29 30
7.2. One-way analysis of variance – F Test 7.2. One-way analysis of variance – F Test
1 2 3 1 2 3
31 32
7.3. Post hoc analysis 7.3. Post hoc analysis
33 34
Tukey’s Honest Significant Difference Kiểm định Tukey được tính bằng Python như sau:
HSD=Honest Significant Difference
35 36
Bài thực hành - Python Hỏi & Đáp …
37 38