Вы находитесь на странице: 1из 6

Department of

Mathematics and Statistics

MINITAB Tip sheet 7


One, two and paired sample t-tests
Use this tip sheet if you want to test means in one or two populations.

Screen shots have been taken from Minitab version 15.

One sample T-test


A one sample t-test is used when you want to test whether a population mean is equal to
some hypothesised value.

When carrying out a one sample t-test there are some assumptions you have to make:
 The variables should be Normally distributed.
 Data should be a random and independent sample from the population.

For this section we will be using the diabetic.txt dataset from the Tip Sheets webpage. The
data are from a study on the effect of oral administration of glucose on diabetic patients.
Plasma glucose levels were measured before and after the treatment, and age also recorded.

Now suppose we want to test a hypotheses testing the following:


Null hypothesis (H0): μ = 0
Alternative hypothesis (H1): μ ≠ 0

(Note: we are testing this hypothesis on the change variable because we want to know
whether the glucose treatment has made a difference to the patient’s diabetes.)

To do this, click on Stat, and then Basic Statistics followed by 1-Sample t. Double click on
the variable Change to move it to the Samples in columns box. Now select the Perform
hypothesis test box and enter in the hypothesis for the population mean you wish to test,
in this case 1.00.

The window should have the following appearance:

For more Tip Sheets, and datasets used within them, visit http://www.reading.ac.uk/statistics/tipsheets/
This project was funded by the generosity of alumni donations to the Annual Fund.

©University of Reading 2011 Page 1


Graphs: Select this option in order
to produce a histogram, individual
plot or box plot of the data.

Options: This allows us to change


the size of the confidence interval
produced, as well as what kind of
alternative hypothesis we want to
test, i.e. one sided greater/ less than
or two sided not equal. We want
Not equal here.

After clicking OK the following output should appear in the Session Window:

One-Sample T: Change

Test of mu = 0 vs not = 0

Variable N Mean StDev SE Mean 95% CI T P


Change 12 1.325 1.023 0.295 (0.675, 1.975) 4.49 0.001

Interpretation: The T statistic (T) is a value which can be used to compare with t-tables to see
whether the test is significant or not using N-1 degrees of freedom, in this case 11.
The p-value (P) determines the significance of the test. In this example the p-value, of 0.001,
is highly significant. Thus we reject the null hypothesis that the mean difference of glucose
measurements is 0, in favour that it is not. We can see that the estimated mean is 1.325,
which suggests that the later measurements are greater than the earlier ones for a patient.

Note: NEVER ACCEPT the null hypothesis and conclude it to be true as this will be incorrect;
we always reject or do not reject the null.

For more Tip Sheets, and datasets used within them, visit http://www.reading.ac.uk/statistics/tipsheets/
This project was funded by the generosity of alumni donations to the Annual Fund.

©University of Reading 2011 Page 2


Two Sample T-test
In a two sample unpaired t-test the data are quantitative and randomly drawn from two
different populations.

When carrying out a two sample t-test there are some assumptions you have to make:
 Variables should be normally distributed.
 Data should be a random and independent sample from each population.

For this section we will be using the lightbulb.txt dataset from the Tip Sheets webpage.
This dataset includes the number of days that a sample of light bulbs from two
manufacturers lasted for.

Equality of Variances
Before carrying out a two sample t-test we must check to see whether the equal population
variances assumption is reasonable, as this will effect which version of the test we use. To
perform this test, click on Stat followed by Basic Statistics and then 2 Variances. Click on
the box labelled Samples in different columns (because our data are from two
manufacturers in two different columns). Enter Manufacturer A in First and Manufacturer B
in Second as seen below:

Options: Use this to change the level


for a confidence interval (ignore this
here).

Storage: You can choose to store the


standard deviations, variances or the
calculated confidence limits.

The different data formats allowed for the test are:


Samples in one column: This is used when you have all the data in the same column i.e.
stacked data. For example if this dataset had the number of days in one column and then
another containing only the name of the manufacturer (A or B), this would be stacked data.
In the Samples box you would have the number of days and in the Subscripts box you
would have the name of the manufacturer.
Samples in different columns: This is used when you have the data in different columns,
as we have here.
Summarized data: This is used when you know the sample size and variance for each of
the two datasets, but you don’t have the raw data.

For more Tip Sheets, and datasets used within them, visit http://www.reading.ac.uk/statistics/tipsheets/
This project was funded by the generosity of alumni donations to the Annual Fund.

©University of Reading 2011 Page 3


Clicking on OK, you should obtain the following results:

Test for Equal Variances: Manufacturer A, Manufacturer B This shows the


95% Bonferroni confidence intervals for standard deviations standard deviation
per manufacturer,
N Lower StDev Upper
Manufacturer A 12 13.7604 20.3490 37.6154 and their 95%
Manufacturer B 12 15.4483 22.8452 42.2295 confidence
intervals.
F-Test (Normal Distribution)
Test statistic = 0.79, p-value = 0.708 We will ignore
these results here:
Levene's Test (Any Continuous Distribution) they are for an
Test statistic = 0.36, p-value = 0.557
alternative test,
This shows the test statistic and its p-value for an F-test of but you may wish
two variance (assuming Normally distributed variables). to use this.

Interpretation: The p-value of 0.708 is large and indicates that there is no evidence to reject
the null hypothesis that the two populations have equal variances. Therefore we will
assume equal variances below, as this assumption does not seem to be unreasonable.

Note: If the p-value is small and significant, then when carrying out the two sample t-test
do not select assume equal variances in the steps to follow. By not selecting this option, a
slightly differently test will be applied, which will not use a pooled estimate of the
population variance, but it will still produce an answer relevant to your problem.

Two sample T-test


From testing our variance we may now reasonably assume that the data have come from
populations with the same variance (we cannot be sure of it though!). We may now perform
a two sample t-test, to test whether the means are equal for the two manufacturers.

To do this, go to Stat followed by Basic Statistics and then click on 2-Sample t. You will
then be presented with the following window:

Select Samples in different columns


and the enter Manufacturer A in
the First box and Manufacturer B in
the Second box.

Make sure the Assume equal


variances box is checked if this is a
reasonable assumption.

In the Options section make sure


the Alternative is set to not equal,
as we wish to perform a two-sided
test in this case.
For more Tip Sheets, and datasets used within them, visit http://www.reading.ac.uk/statistics/tipsheets/
This project was funded by the generosity of alumni donations to the Annual Fund.

©University of Reading 2011 Page 4


For this example we are testing the following hypotheses:
Null hypothesis (H0): μA = μB (Manufacturer A has equal mean to Manufacturer B)
Alternative hypothesis (H1): μA ≠ μB (Manufacturer A’s mean is not equal to Manufacturer B)

You should obtain the following output:


Two-Sample T-Test and CI: Manufacturer A, Manufacturer B

Two-sample T for Manufacturer A vs Manufacturer B

N Mean StDev SE Mean This shows some of the


Manufacturer A 12 214.4 20.3 5.9 descriptive statistics for each
Manufacturer B 12 232.9 22.8 6.6
of the two manufacturers.

Difference = mu (Manufacturer A) - mu (Manufacturer B)


Estimate for difference: -18.50
95% CI for difference: (-36.82, -0.18)
T-Test of difference = 0 (vs not =): T-Value = -2.09 P-Value = 0.048 DF = 22
Both use Pooled StDev = 21.6331

The difference of -18.5 is the estimated mean for manufacturer A minus


the estimated mean for manufacturer B. The 95% confidence interval is for
the difference in population means.

Interpretation: The T-statistic of -2.095 and p-value of 0.048 on 22 degrees of freedom


shows us that we can reject the null hypothesis of the two manufacturers’ means being
equal and instead conclude that there is a difference between the two at the 5% level.

Paired T-test
In paired T-tests the data obtained are related in some way, so the two samples of data are
not independent.

For this section we will be using the cholesterol.txt dataset from the Tip Sheets webpage.
This dataset consists of cholesterol levels in patients two and four days after a heart attack.
Note: these data are paired because the two measurements have been made on the same
individuals.

For this example we will be testing the following hypotheses:


Null hypothesis (H0): μA = μB (mean cholesterol is the same after 2 days as it is after 4 days)
Alternative hypothesis (H1): μA ≠ μB (The mean cholesterol level is different)

Go to Stat followed by Basic Statistics and then click on Paired t. Click in the box next to
Samples in Columns. Enter 2 days in First sample and 4 days after in Second sample.
Check that the Alternative is set to not equal by clicking on the Options button.

You should obtain the following results:

For more Tip Sheets, and datasets used within them, visit http://www.reading.ac.uk/statistics/tipsheets/
This project was funded by the generosity of alumni donations to the Annual Fund.

©University of Reading 2011 Page 5


Paired T-Test and CI: 2 days after, 4 days after This shows the number of
observations (N), mean,
Paired T for 2 days after - 4 days after
standard deviation (StDev) and
N Mean StDev SE Mean standard error of the mean (SE
2 days after 10 225.0 49.8 15.8
4 days after 10 204.5 46.6 14.7 mean) for each of the variables
Difference 10 20.50 27.73 8.77 (2 days after and 4 days after),
and for the difference between
95% CI for mean difference: (0.67, 40.33)
T-Test of mean difference = 0 (vs not = 0):
the observations, which is 2
T-Value = 2.34 P-Value = 0.044 days after minus 4 days after.

The 95% confidence interval for the mean difference in cholesterol levels
between the two time periods, T-statistic (T-value) and p-value are given.

Interpretation: The p-value of 0.044 shows us that we can reject the null hypothesis of the
two means being equal and instead conclude that there is a difference between the mean
cholesterol levels 2 days after and 4 days after, at the 5% level.

Note: performing a one sample t-test on the differences between two related variables is
equivalent to performing a paired t-test on the two variables.

Extra information on interpretation


 P-value: When interpreting the p-value for a test, if the value is less than 0.05 then
the test is significant at the 5% level, and we would usually say there is evidence to
reject the null hypothesis. If the p-value is less than 0.1 but greater than 0.05 then
there is weak evidence in favour of the alternative hypothesis. Finally if the p-value is
greater than 0.1 then we would usually say there is no evidence to reject the null
hypothesis. Note: NEVER ACCEPT the null hypothesis and conclude it to be true as
this will be incorrect; we always reject or do not reject the null.
 Confidence Interval: If the 95% confidence interval of a difference in means does
not include zero then there is evidence that there is a difference in the population
means (i.e. rejecting the null hypothesis).
 Standard deviation and Standard Error Mean: The standard deviation is an
estimate of how variable the values are in the population. The standard error of the
mean shows the uncertainty of the estimated mean as an estimate of the true
unknown population mean (note: this will become smaller as the sample size
becomes larger).
Note: we should report p<0.001 if Minitab gives 0.000 in the output for a p-value.

And finally ...


If you are unsure about the correct statistical methods to apply in the analysis of your data,
book an appointment for our Statistical Advisory Service (www.reading.ac.uk/Stats-Advisory).
We will be pleased to advise you on aspects of design, analysis and interpretation.
Portions of the input and output contained in this publication are printed with permission of Minitab Inc. All
material remains the exclusive property and copyright of Minitab Inc. All rights reserved.
For more Tip Sheets, and datasets used within them, visit http://www.reading.ac.uk/statistics/tipsheets/
This project was funded by the generosity of alumni donations to the Annual Fund.

©University of Reading 2011 Page 6

Вам также может понравиться