Download Two sample t-test: Independent Samples Have data from two

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

Bootstrapping (statistics) wikipedia , lookup

Taylor's law wikipedia , lookup

Misuse of statistics wikipedia , lookup

Resampling (statistics) wikipedia , lookup

Student's t-test wikipedia , lookup

Transcript
Two sample t-test: Independent Samples
Have data from two samples. In this case from readings of bacteria in
carpeted hospital rooms (sample 1) and uncarpeted hospital rooms (sample
2). Want to test that the mean for the uncarpeted is lower than the mean
for the carpeted ie H0 : µ1 = µ2 versus HA : µ1 > µ2 .
Welcome to Minitab, press F1 for help.
MTB > set c1
DATA> 11.8 8.2 7.1 13.0 10.8 10.1 14.6 14.0
DATA> end
MTB > set c2
DATA> 12.1 8.3 3.8 7.2 12.0 11.1 10.1 13.7
DATA> end
MTB > describe c1 c2
Descriptive Statistics: C1, C2
Variable
C1
C2
N
8
8
Variable
C1
C2
MTB >
MTB >
SUBC>
SUBC>
Mean
11.200
9.79
Minimum
7.100
3.80
Median
11.300
10.60
Maximum
14.600
13.70
help twosample
twosample c1 c2;
alternative 1;
pool.
Two-Sample T-Test and CI: C1, C2
Two-sample T for C1 vs C2
C1
N
8
Mean
11.20
StDev
2.68
SE Mean
0.95
1
TrMean
11.200
9.79
Q1
8.675
7.48
StDev
2.677
3.21
Q3
13.750
12.08
SE Mean
0.947
1.13
C2
8
9.79
3.21
1.1
Difference = mu C1 - mu C2
Estimate for difference: 1.41
95% lower bound for difference: -1.19
T-Test of difference = 0 (vs >): T-Value = 0.96
P-Value = 0.178 DF = 14
Both use Pooled StDev = 2.96
MTB >
MTB >
DATA>
DATA>
MTB >
stack c1 c2 c3
set c4
8(1) 8(2)
end
boxplot c3*c4
What is the appropriate conclusion?
Matched or Paired Data
Have data from problem 5 page 278 in Pagano. For each subject we have
a reading of LDL cholesterol (mmol/l) from the time they ate cornflakes
and the time they ate oat bran. Since one individual generate a pair of
observations (observations are matched in pairs), we have matched or paired
data. Analysis is done of the difference of the observations. If µd is the
population mean of the differences (cornflakes-oatbran), then H0 : µd = 0
and HA : µd > 0.
MTB >
DATA>
DATA>
MTB >
DATA>
DATA>
MTB >
MTB >
set c10
4.61 6.42 5.4 4.54 3.98 3.82 5.01 4.34 3.80 4.56 5.35 3.89 2.25 4.24
end
set c11
3.84 5.57 5.85 4.80 3.68 2.96 4.41 3.72 3.49 3.84 5.26 3.73 1.84 4.14
end
let c12=c10-c11
desc c12
Descriptive Statistics: C12
2
Variable
C12
Variable
C12
N
14
Mean
0.363
Minimum
-0.450
Median
0.360
Maximum
0.860
TrMean
0.389
Q1
0.098
StDev
0.406
SE Mean
0.108
Q3
0.732
MTB > ttest c12;
SUBC> alternative 1.
One-Sample T: C12
Test of mu = 0 vs mu > 0
Variable
C12
Variable
C12
N
14
Mean
0.363
StDev
0.406
95.0% Lower Bound
0.171
T
3.34
SE Mean
0.108
P
0.003
What is the conclusion?
Power and Sample Size Calculations
In carrying out a test of hypothesis, we often want to choose a sample
size to give us certain characteristics of the test. Alternatively we may have
a fixed sample size and want to determine the characteristics of the test.
Typically we fix the size of the test which is the probability of making a type
one error, usually denoted by α. For a fixed value in HA , the power is the
probability of rejecting HA under the value of the parameter specified. Power
is 1-probabilty of making a type II error, so we want the power to be large.
The steps for computing the power are as follows:
1. Specify α, often 0.05.
2. Specify the difference we want to detect ie if we are comparing two
means, we would specify how far apart the means have to be to be of
practical importance.
3. Give the sample size and standard deviation, sigma.
3
4. Run Minitab command tone or ttwo with subcomands alpha=,sigma=,difference=,
sample=. Answer is the power.
In order to determine the sample size needed to give a power of a certain
value, the steps are as follows:
1. Specify α, often 0.05.
2. Specify the difference we want to detect ie if we are comparing two
means, we would specify how far apart the means have to be to be of
practical importance.
3. Give the desired power and standard deviation, sigma.
4. Run Minitab command tone or ttwo with subcomands alpha=,sigma=,difference=,
power=. Answer is the sample size required.
Examples of power calculations based on the hospital rooms example.
First we compute the power for detecting a difference of 1.4 (the observed
difference). We then ask what sample size we need to get a power of 0.8 for
this difference.
MTB >
SUBC>
SUBC>
SUBC>
SUBC>
SUBC>
power;
ttwo;
alpha .05;
diff 1.4;
sigma 3;
sample 8.
Testing mean 1 = mean 2 (versus not =)
Calculating power for mean 1 = mean 2 + difference
Alpha = 0.05 Sigma = 3
Difference
1.4
Sample
Size
8
Power
0.1403
MTB > power;
SUBC> ttwo;
4
SUBC>
SUBC>
SUBC>
SUBC>
alpha .05;
diff 1.4;
sigma 3;
power .8.
Power and Sample Size
2-Sample t Test
Testing mean 1 = mean 2 (versus not =)
Calculating power for mean 1 = mean 2 + difference
Alpha = 0.05 Sigma = 3
Difference
1.4
Sample
Size
74
Target
Power
0.8000
Actual
Power
0.8051
5