1. L p Ph ng ph叩p NCKH Ch ng tr狸nh CUD UPNT03
S D NG STATA 10.0 PHN TCH TH NG K
TRONG NGHIN C U KHOA H C
KI M NH GI THI T
TS. BS T ng Kim H ng
1. Ki m nh s trung b狸nh
1.1 Ki m nh 1 s trung b狸nh
M file PULSE ph但n t鱈ch.
- L nh s d ng trong STATA nh sau:
+ Statistics -> Summaries, tables and tests -> Classical tests of hypotheses -> One
sample mean comparison test -> Ch n bi n s c n ki m nh v gi叩 tr c n ki m nh, v鱈
d ch n bi n s Pulse1v hypothezied value la 80 -> Submit
(Gi s gi nh v ph但n ph i b狸nh th ng c a bi n s 達 c th a)
1
2. L p Ph ng ph叩p NCKH Ch ng tr狸nh CUD UPNT03
t qu c坦 c nh sau:
. ttest pulse1 == 80
One-sample t test
------------------------------------------------------------------------------
Variable | Obs Mean Std. Err. Std. Dev. [95% Conf. Interval]
---------+--------------------------------------------------------------------
pulse1 | 92 72.86957 1.147737 11.00871 70.58973 75.1494
------------------------------------------------------------------------------
mean = mean(pulse1) t = -6.2126
Ho: mean = 80 degrees of freedom = 91
Ha: mean < 80 Ha: mean != 80 Ha: mean > 80
Pr(T < t) = 0.0000 Pr(|T| > |t|) = 0.0000 Pr(T > t) = 1.0000
T k t qu ny, ta th y r ng: V狸 gi叩 tr p <0.0001, n棚n ch炭ng ta lo i b H0 v k t lu n
r ng d a tr棚n m u ny, trung b狸nh m ch c a b nh nh但n trong d但n s kh叩c bi t v i gi叩 tr
80 l n/ph炭t m t c叩ch c坦 箪 ngh a
- T鱈nh v i s c坦 s n, l nh s d ng trong STATA nh sau:
ttesti n x s 袖 0
V鱈 d v i m u 50 b nh nh但n, c坦 trung b狸nh amylase huy t thanh l 96 v/ml, l ch
chu n 35, ta c坦 th ch!ng minh trung b狸nh amylase huy t thanh trong d但n s c坦 th c s
kh叩c v i gi叩 tr 120 v/ml kh担ng?
- L nh trong SATAT:
+ Statistics -> Summaries, tables and tests -> Classical tests of hypotheses -> One
sample mean comparison calculator
2
3. L p Ph ng ph叩p NCKH Ch ng tr狸nh CUD UPNT03
t qu c坦 c nh sau:
. ttesti 50 96 35 120
One-sample t test
------------------------------------------------------------------------------
| Obs Mean Std. Err. Std. Dev. [95% Conf. Interval]
---------+--------------------------------------------------------------------
x | 50 96 4.949747 35 86.05311 105.9469
------------------------------------------------------------------------------
mean = mean(x) t = -4.8487
Ho: mean = 120 degrees of freedom = 49
Ha: mean < 120 Ha: mean != 120 Ha: mean > 120
Pr(T < t) = 0.0000 Pr(|T| > |t|) = 0.0000 Pr(T > t) = 1.0000
T k t qu ny, ta th y r ng: V狸 gi叩 tr p <0.0001, n棚n ch炭ng ta lo i b H0 v k t lu n
r ng d a tr棚n m u ny, trung b狸nh amylase huy t thanh c a d但n s kh叩c bi t v i gi叩 tr
120 v/ml m t c叩ch c坦 箪 ngh a
1.2 Ki m nh s kh叩c bi t c a 2 s trung b狸nh
1.2.1 Ki m nh s kh叩c bi t c a 2 s trung b狸nh l y t 2 m u kh叩c
nhau
- L nh s d ng trong STATA nh sau:
+ Statistics -> Summaries, tables and tests -> Classical tests of hypotheses -> Two
sample mean comparison test -> Ch n 2 bi n s c n so s叩nh s trung b狸nh -> Submit
- T鱈nh v i s c坦 s n, l nh s d ng trong STATA nh sau:
ttesti n1 x1 s1 n2 x2 s2
V鱈 d : M t nh坦m nghi棚n c!u thu th p s li u amylase huy t thanh t m t m u g m
nh"ng ng i kh e m nh v 1 m u t nh"ng b nh nh但n trong b nh vi n. Nh坦m NC mu n
bi t trung b狸nh amylase huy t thanh c a 2 d但n s c坦 kh叩c nhau hay kh担ng. D" li u v 2
m u nh sau:
M u n x SD
Ng i kh e m nh 50 96 35
B nh nh但n 60 120 40
3
4. L p Ph ng ph叩p NCKH Ch ng tr狸nh CUD UPNT03
- L nh trong STATA:
+ Statistics -> Summaries, tables and tests -> Classical tests of hypotheses -> Two
sample mean comparison calculator
t qu c坦 c nh sau:
. ttesti 50 96 35 60 120 40
Two-sample t test with equal variances
------------------------------------------------------------------------------
| Obs Mean Std. Err. Std. Dev. [95% Conf. Interval]
---------+--------------------------------------------------------------------
x | 50 96 4.949747 35 86.05311 105.9469
y | 60 120 5.163978 40 109.6669 130.3331
---------+--------------------------------------------------------------------
combined | 110 109.0909 3.766917 39.50776 101.625 116.5568
---------+--------------------------------------------------------------------
diff | -24 7.240735 -38.35239 -9.647607
------------------------------------------------------------------------------
diff = mean(x) - mean(y) t = -3.3146
Ho: diff = 0 degrees of freedom = 108
Ha: diff < 0 Ha: diff != 0 Ha: diff > 0
Pr(T < t) = 0.0006 Pr(|T| > |t|) = 0.0013 Pr(T > t) = 0.9994
T k t qu ny, ta th y r ng: V狸 gi叩 tr p = 0.0013 <0.05, n棚n ch炭ng ta lo i b H0 v k t
lu n r ng d a tr棚n s li u ny, ch炭ng ta c坦 th k t lu n m!c 箪 ngh a 5% r ng trung b狸nh
amylase huy t thanh c a d但n s ng i b狸nh th ng v ng i b nh kh叩c bi t nhau m t
c叩ch c坦 箪 ngh a.
* L u 箪: Tr c khi so s叩nh 2 s trung b狸nh c n ph i ki m nh xem ph ng sai c坦 b ng
nhau hay kh担ng quy t nh ch#n ph ng sai b ng nhau hay kh担ng b ng nhau khi lm
ph辿p ki m t (s$ gi i th鱈ch r探 trong ph n d i 但y)
* Ki m nh s kh叩c bi t c a 2 s trung b狸nh l y t 2 nh坦m
M file PULSE ph但n t鱈ch.
- V鱈 d : ch炭ng ta c n so s叩nh trung b狸nh c但n n%ng c a 2 nh坦m nam v n"
- Tr c ti棚n ch炭ng ta c n so s叩nh ph ng sai c a hai nh坦m xem ph ng sai c坦 b ng
nhau hay kh担ng.
4
5. L p Ph ng ph叩p NCKH Ch ng tr狸nh CUD UPNT03
L nh s d ng trong STATA nh sau:
+ Statistics -> Summaries, tables and tests -> Classical tests of hypotheses -> Two group
variance comparison test -> Ch n bi n s c n ki m nh (weigh) v bi n s ph但n nh坦m
(sex) -> Submit
(Gi s gi nh v ph但n ph i b狸nh th ng c a bi n s 達 c th a)
t qu c坦 c nh sau:
. sdtest weight, by(sex)
Variance ratio test
------------------------------------------------------------------------------
Group | Obs Mean Std. Err. Std. Dev. [95% Conf. Interval]
---------+--------------------------------------------------------------------
1 | 57 69.82456 1.100274 8.306888 67.62045 72.02868
2 | 35 54.57143 .9977165 5.90257 52.54382 56.59903
---------+--------------------------------------------------------------------
combined | 92 64.02174 1.098035 10.53198 61.84063 66.20285
------------------------------------------------------------------------------
ratio = sd(1) / sd(2) f = 1.9806
Ho: ratio = 1 degrees of freedom = 56, 34
Ha: ratio < 1 Ha: ratio != 1 Ha: ratio > 1
Pr(F < f) = 0.9825 2*Pr(F > f) = 0.0351 Pr(F > f) = 0.0175
H0: T& s 2 ph ng sai (sd1 v sd2) b ng 1, t!c l sd1 = sd2
T k t qu ny, ta th y r ng: V狸 gi叩 tr p = 0.0351 <0.05, n棚n ch炭ng ta lo i b H0 (2
ph ng sai b ng nhau) v k t lu n r ng d a tr棚n s li u ny, ch炭ng ta c坦 th k t lu n
m!c 箪 ngh a 5% r ng ph ng sai c a c但n n%ng nam v n" kh叩c bi t nhau m t c叩ch c坦
箪 ngh a.
- Sau khi 達 x叩c nh l ph ng sai c a 2 m u kh担ng b ng nhau, ta so s叩nh 2 s trung
b狸nh c a 2 m u (v i i u ki n ph ng sai kh担ng b ng nhau)
L nh s d ng trong STATA nh sau:
5
6. L p Ph ng ph叩p NCKH Ch ng tr狸nh CUD UPNT03
+ Statistics -> Summaries, tables and tests -> Classical tests of hypotheses -> Two group
mean comparison test -> Ch n bi n s c n ki m nh (weigh) v bi n s ph但n nh坦m (sex)
-> Ch n unequal variances -> Submit
(Gi s gi nh v ph但n ph i b狸nh th ng c a bi n s 達 c th a)
t qu c坦 c nh sau:
. ttest weight, by(sex) unequal
Two-sample t test with unequal variances
------------------------------------------------------------------------------
Group | Obs Mean Std. Err. Std. Dev. [95% Conf. Interval]
---------+--------------------------------------------------------------------
1 | 57 69.82456 1.100274 8.306888 67.62045 72.02868
2 | 35 54.57143 .9977165 5.90257 52.54382 56.59903
---------+--------------------------------------------------------------------
combined | 92 64.02174 1.098035 10.53198 61.84063 66.20285
---------+--------------------------------------------------------------------
diff | 15.25313 1.485275 12.30145 18.20481
------------------------------------------------------------------------------
diff = mean(1) - mean(2) t = 10.2696
Ho: diff = 0 Satterthwaite's degrees of freedom = 87.9805
Ha: diff < 0 Ha: diff != 0 Ha: diff > 0
Pr(T < t) = 1.0000 Pr(|T| > |t|) = 0.0000 Pr(T > t) = 0.0000
H0: S kh叩c bi t 2 s trung b狸nh (mean1 v mean2) b ng 0, t!c l mean1 = mean2
T k t qu ny, ta th y r ng: V狸 gi叩 tr p < 0.0001, n棚n ch炭ng ta lo i b H0 (2 trung b狸nh
b ng nhau) v k t lu n r ng d a tr棚n s li u ny, ch炭ng ta c坦 th k t lu n m!c 箪 ngh a
5% r ng trung b狸nh c但n n%ng c a nam v n" kh叩c bi t nhau m t c叩ch c坦 箪 ngh a.
1.2.2 Ki m nh s kh叩c bi t c a 2 s trung b狸nh l y t c湛ng 1 m u (so
s叩nh tr c-sau, so s叩nh c p
M file PULSE ph但n t鱈ch.
- V鱈 d : ch炭ng ta c n so s叩nh trung b狸nh m ch tr c v sau khi d湛ng thu c c坦 kh叩c nhau
kh担ng
L nh s d ng trong STATA nh sau:
+ Statistics -> Summaries, tables and tests -> Classical tests of hypotheses -> Mean
comparison test, paired data -> Ch n bi n s c n ki m nh -> Submit
(Gi s gi nh v ph但n ph i b狸nh th ng c a bi n s 達 c th a)
6
7. L p Ph ng ph叩p NCKH Ch ng tr狸nh CUD UPNT03
t qu c坦 c nh sau:
. ttest pulse1 == pulse2
Paired t test
------------------------------------------------------------------------------
Variable | Obs Mean Std. Err. Std. Dev. [95% Conf. Interval]
---------+--------------------------------------------------------------------
pulse1 | 90 72.53333 1.141237 10.82673 70.26572 74.80095
pulse2 | 90 78.8 1.601981 15.19772 75.6169 81.9831
---------+--------------------------------------------------------------------
diff | 90 -6.266667 1.294259 12.27842 -8.838332 -3.695002
------------------------------------------------------------------------------
mean(diff) = mean(pulse1 - pulse2) t = -4.8419
Ho: mean(diff) = 0 degrees of freedom = 89
Ha: mean(diff) < 0 Ha: mean(diff) != 0 Ha: mean(diff) > 0
Pr(T < t) = 0.0000 Pr(|T| > |t|) = 0.0000 Pr(T > t) = 1.0000
H0: Trung b狸nh c a s kh叩c bi t (pulse1 - pulse2) b ng 0
T k t qu ny, ta th y r ng: V狸 gi叩 tr p < 0.0001, n棚n ch炭ng ta lo i b H0 (trung b狸nh
c a s kh叩c bi t =0) v k t lu n r ng d a tr棚n s li u ny, ch炭ng ta c坦 th k t lu n m!c
箪 ngh a 5% r ng trung b狸nh c a s kh叩c bi t nh p m ch c a b nh nh但n tr c v sau khi
i u tr kh叩c 0, hay n坦i c叩ch kh叩c trung b狸nh m ch c a b nh nh但n tr c v sau khi i u
tr kh叩c nhau m t c叩ch c坦 箪 ngh a.
2. Ki m nh t l
2.1 Ki m nh 1 t l
- L nh s d ng trong STATA nh sau:
+ Statistics -> Summaries, tables and tests -> Classical tests of hypotheses -> One
sample proportion test -> Ch n bi n s c n ki m nh v gi叩 tr c n ki m nh, v鱈 d
ch n bi n s smoke v hypothezied value l 0.15 -> Submit
7
8. L p Ph ng ph叩p NCKH Ch ng tr狸nh CUD UPNT03
2.2 Ki m nh 2 t l
- L nh s d ng trong STATA nh sau:
+ Statistics -> Summaries, tables and tests -> Classical tests of hypotheses -> Two
sample proportion test -> Ch n bi n s c n ki m nh -> Submit
* Ki m nh s kh叩c bi t c a 2 t l l y t 2 nh坦m
M file PULSE ph但n t鱈ch.
- V鱈 d : ch炭ng ta c n so s叩nh t& l h炭t thu c l叩 c a nam v n"
- L nh s d ng trong STATA nh sau:
+ Statistics -> Summaries, tables and tests -> Classical tests of hypotheses -> Two group
proportion test -> Ch n bi n s c n ki m nh (smokes) v bi n s ph但n nh坦m (sex) ->
Submit
8
9. L p Ph ng ph叩p NCKH Ch ng tr狸nh CUD UPNT03
3. Ph辿p ki m chi-b狸nh ph ng (chi-square)
M file PULSE ph但n t鱈ch.
9
10. L p Ph ng ph叩p NCKH Ch ng tr狸nh CUD UPNT03
- L nh s d ng trong STATA nh sau:
+ Statistics -> Summaries, tables and tests -> Tables -> Two way tables with measures
of association -> Nh p bi n s cho hng v c t -> Ch n ph辿p ki m c n s d ng (v鱈 d
Chi-square hay Fishers exact test -> Submit
(N u mu n c坦 t l theo hng th狸 ch n th棚m within- row relative frequency, n u mu n
c坦 t l theo c t th狸 ch n th棚m within- column relative frequency)
- T鱈nh v i s c坦 s n, l nh s d ng trong STATA nh sau:
tabi a bc de f, chi 2
hay
tabi a bc de f, exact
10