You are on page 1of 5

Monika Piwowar

mpiwowar@cm-uj.krakow.pl

t-Student test
Quick history:

William Sealy Gosset,


English statistician,
chemist and brewer
who developed the
"t-statistic" and
published it under
the pseudonym of
"Student".

In the year 1908, an Englishman named William Sealy Gosset developed the t-
test as well as t distribution.

Gosset worked as a head brewer of the Guinness brewery in Dublin and found
which existing statistical techniques using large samples were not useful for the
small sample sizes which he encountered in his work.

“Necessity is the mother of invention”

-------------------------- Some terms before testing -----------------------------------------

Independent samples vs dependent samples:

• Independent samples are measurements made on several different sets of items


(different populations, e.g. you might want to compare age of patients in two
different hospitals).
• Dependent samples are repeated measurements for one set of items (e.g. you
follow history of the same group of patients and analyse concentration of
glutathione in plasma before and after a specific treatment)

There are three types (version) of t-test:

• Two-samples t test for independent samples (is used to compare two means
from independent populations)
• Paired t test for dependent samples (is used to compare two means from
dependent population)
• One-sample t test (is used for one sample and one mean value)
Monika Piwowar
mpiwowar@cm-uj.krakow.pl

Caution! Remember that two-samples and paired t test can be used to TWO AND
ONLY TWO MEANS. No more! If you need to compare more than two means you
have to you other statistical algorithm, e.g. one-way analysis of variance (one-way
ANOVA).

Consider a drug company that wants to test the effectiveness of a new drug in reducing
blood pressure. They could collect data in two ways:

• Sample the blood pressures of the same people before and after they receive a
dose. The two samples are dependent because they are taken from the same
people. The people with the highest blood pressure in the first sample will likely
have the highest blood pressure in the second sample.

• Give one group of people an active drug and give a different group of people an
inactive placebo, then compare the blood pressures between the groups. These
two samples would likely be independent because the measurements are from
different people. Knowing something about the distribution of values in the first
sample doesn't inform you about the distribution of values in the second.

-------------------------------------------------------------------------------------------------

Two-samples t-test
(independent two samples)
The idea of the t test for independent samples (two-sample t-test) is to compare means
of variable of interest in two different populations. As the test name indicates the
populations (samples) must be independent to each other, the measurement results of
one population are not dependent on the measurement to the other one.

Hypothesis testing involving the difference between two population means is the most
frequently employed to determine whether or not it is reasonable to conclude that the
two population means are unequal. In such case, the following hypotheses may be
formulated:

H0 - The null hypothesis states that:


Monika Piwowar
mpiwowar@cm-uj.krakow.pl

• The difference between mean value of the variable of interest in the first
population and mean value of the variable of interest in the second population is
not significant.
• The mean values of the variable of interest do not differ significantly between two
studied populations.
• The qualitative factor, that distinguish between populations, is not significant
predictor of the mean value of the variable of interest (it does not make that the
mean values differed in statistically significant way).

H1 - The alternative hypothesis is opposite to the H0

Alpha value (significance level) = 0.05

How to do it in R
# Two-samples t test (independent 2-group t-test)

t.test(y~x) # where y is numeric and x is a binary factor

Paired t-test
(dependent 2-group t-test)
The idea of the Student's t test for dependent samples (paired version) is double
comparison the same group of people (observations). Our group (sample) are
mutually dependent, because the second test result is dependent on the outcome of the first
study. The purpose of Student's t test paired version is to establish the magnitude of
changes in the measurement of the examined observations.

A method frequently employed for assessing the effectiveness of a treatment or experimental


procedure is one that makes use of related observations resulting from nonindependent
samples. A hypothesis test based on this type of data is known as a paired comparisons test.
The objective in paired comparisons tests is to eliminate a maximum number of sources of
extraneous variation by making the pairs similar with respect to as many variables as possible.

H0 - The null hypothesis states that:

• The difference between mean value of the variable of interest in the first
measurement time point and mean value of the variable of interest in the second
measurement time point is not significant.
• The mean values of the variable of interest do not differ significantly between two
measurement points.
Monika Piwowar
mpiwowar@cm-uj.krakow.pl

• The qualitative factor (e.g. treatment, time), that distinguish between two
measurement points, is not significant predictor of the mean value of the variable of
interest.

H1 - The alternative hypothesis is opposite to the H0

Alpha value (significance level) = 0.05

How to do it in R
# paired t test (dependent 2-group t-test)

t.test(y1,y2,paired=TRUE) # where y1 and y2 are numeric

One-sample t-test
The idea of the ne-sample t test is the comparison of mean in one group of subjects
with the established mean value µ0 (well-known in the theory or from other researches).
Comparison of one group is an exception in the family of t-tests.

The null hypothesis states that there is no significant difference between the mean value in
the whole population (µ) and the established mean value (µ0).

How to do it in R
# one sample t-test

t.test(y,mu=3) # H0: mu=3


Monika Piwowar
mpiwowar@cm-uj.krakow.pl

General rule for statistical testing


If p value < or = 0.05 we can accept H1

If p value > 0.05 in principle, we cannot say for sure that H0 is


correct, but since we have no evidence that it is not, we take it
as true.

You might also like