2014.3.18 1 Medical Statistics Medical Statistics Tao Yuchun Tao Yuchun 7
-
Upload
quentin-daniels -
Category
Documents
-
view
229 -
download
1
description
Transcript of 2014.3.18 1 Medical Statistics Medical Statistics Tao Yuchun Tao Yuchun 7
2014.3.181
Medical StatisticsMedical Statistics
Tao YuchunTao Yuchun
77
http://cc.jlu.edu.cn/ms.html
2014.3.182
Statistical inferenceStatistical inference
3. t test and Z test
2014.3.183
3.1 t test
(1)(1) Comparing to a given population meanComparing to a given population mean (One-sample (One-sample tt test) test)• SeeSee ExampleExample 6-1 and 6-1 and ExampleExample 6-2 in last class.6-2 in last class. ( see ( see 2014MedicalStatistics6.ppt2014MedicalStatistics6.ppt))• The formula of the test statistic for one-sampleThe formula of the test statistic for one-sample tt test is: test is:
)(~ t
nS
Xt 1n
• here μ is a given population mean.
2014.3.184
• One-sample t test is also called the t test for one group of data under completely randomizedcompletely randomized designdesign.
•QuestionQuestion:: What is completely randomizedWhat is completely randomized design?design?• Design for the individuals to be observed are completely randomly selected from the population.
2014.3.185
(2)(2) Comparison for Paired Data Comparison for Paired Data (Paired-Samples (Paired-Samples tt test) test)• Paired-Samples t test is also called the t test for data under randomized paired designrandomized paired design.
•QuestionQuestion:: What is randomized pairedWhat is randomized paired design?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.
2014.3.186
•ExampleExample 7-1: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
2014.3.187
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.
0:0 dH
0:1 dH
02.48/16.3
50.4/
0
nsdtd
05.0
5.4836
d 16.318
8/362321
/)( 222
n
nddS iid
•You can see “exp7-1.xls”.
2014.3.188
• The formula of the test statistic for The formula of the test statistic for paired-- sample sample tt test is: test is:
)(~0 t
nSdt
d
1n
• here and Sd refer to the mean and SD of the variable “difference”.d
2014.3.189
(3)(3) Comparison between two sampleComparison between two sample means (Independent-Samples means (Independent-Samples tt test) test)• Independent-Samples t test is also called the t test for comparing two means based on two groups of data under completely randomizedcompletely randomized designdesign.
•ExampleExample 7-2: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.
2014.3.1810
Comparing the effects of different food on increasing weight for two groups of rats High Protein 134 146 104 119 124 161 107 83 113 129 97 123
low Protein 70 118 101 85 107 132 94
210 : H
211 : H05.0
• First, you should calculate the (called pooled estimation of sample variancepooled estimation of sample variance):
2cS
2)1()1(
21
222
2112
nn
SnSnSc
2014.3.1811
891.105.10101120
05.10)71
121(12.446)11(
12.4462712
7/7077395912/1440177832
2/)(/)(
2)()(
21
1
21
21
2
222
21
22
2221
21
21
21
222
2112
XX
cXX
c
c
sXXt
nnss
s
nnnXXnXX
nnXXXX
s
x
•You can see “exp7-2.xls”.
2014.3.1812
υ=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.
2014.3.1813
The formula of the test statistic for The formula of the test statistic for independent--samples samples tt test is: test is:
2)1()1(
21
222
2112
nn
SnSnSc
2
)()(
21
1
222
1
211
21
nn
XXXXn
ii
n
ii
)11(21
2
2121
21
nnS
XXS
XXt
cXX
• here Sc2
is pooled estimation of sample variance.• This This tt test is for assumption of the test is for assumption of the variances variances of two populations being equal. of two populations being equal.
2014.3.1814
The t test is a statistical method for comparing differences between two groupstwo groups. • The t test requires a continuous a continuous dependent dependent variablevariable on which the groups are being compared.• The t test assumes that the variable is normallynormally distributeddistributed in the populations from which the samples are drawn and that the samples have equivalent variancesequivalent variances. The t test is particularly useful in experimental and quasi-experimental designs in which an experimental and a control group are compared.
2014.3.1815
• If If t t ≥≥ttα,α,νν , , thenthen P P ≤ ≤αα ,, reject reject HH0 0 at at
significance levelsignificance levelαα=0.05.=0.05.• If If t t << ttα,α,νν , , thenthen P P >> αα ,, accept accept HH0 0 atat
significance levelsignificance levelαα=0.05.=0.05.• You can findYou can find ttα,α,νν in Student’s t table !in Student’s t table !
You may also use Excel’s function tinvtinv((α,α,νν)) to get it. Remember it for Two-sided ! One-sided just use tinvtinv(2(2α,α,νν)) !
•QuestionQuestion:: How do I draw a conclusion How do I draw a conclusion by any by any t t test ?test ?
2014.3.1816
3.2 Z test
(1)(1) Comparing to a given population meanComparing to a given population mean for a for a bigbig sample (One-sample sample (One-sample ZZ test) test)
• The formula of the test statistic for one-sampleThe formula of the test statistic for one-sample ZZ test is: test is:
ondistributiZ
nS
XZ _~
• Z distribution is N(0,1).
2014.3.1817
• bigbig means sample size means sample size nn ≥ 50. ≥ 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α,ν.
58.2,96.1 01.005.0 ZZ•Two sides:
•One side: 33.2,65.1 01.005.0 ZZ
• The example omitted.
2014.3.1818
(2)(2) Comparison between two Comparison between two bigbig sample sample means (Two-Samples means (Two-Samples ZZ test) test)• bigbig means two sample size all means two sample size all nn ≥ 50. ≥ 50.
•The formula of the test statistic for two-samplesThe formula of the test statistic for two-samples
ZZ test is: test is:
2
22
1
21
21
22
2121
2121
nS
nS
XX
SS
XXS
XXZ
XXXX
2014.3.1819
• 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α,ν.
58.2,96.1 01.005.0 ZZ•Two sides:
•One side: 33.2,65.1 01.005.0 ZZ
• The example omitted.
•QuestionQuestion:: How do I draw a conclusion How do I draw a conclusion by any by any Z Z test ?test ?
2014.3.1820
• If If Z Z ≥≥ZZαα , , thenthen P P ≤ ≤αα ,, reject reject HH0 0 at at
significance levelsignificance levelαα=0.05.=0.05.• If If Z Z << ZZαα , , thenthen P P >> αα ,, accept accept HH0 0 atat
significance levelsignificance levelαα=0.05.=0.05.
• ZZαα in your heart !in your heart !I remember it !Z0.05=1.96, Z0.01=2.58 ! Two-sided !
2014.3.1821
3.3 Attention for Hypothesis Testingaa. What does What does PP-value mean?-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.
2014.3.1822
bb. What does the significance level What does the significance level αα mean? mean?
α shows the quality of the inference.
If you reject the null hypothesis, the probability of making
mistake is limited by α .
cc. What are type I error and type II error?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.
2014.3.1823
CC
• You should know Hypothesis Testing is a very important method in statistics !
(http://en.wikipedia.org/wiki/Forbidden_City)