You are on page 1of 5

ASSIGNMENT TOPIC : T-TEST

SUBMITTED TO : DR. JAVID IQBAL

SUBMITTED BY : HASEENA TABASUM

ROLL NO : 59425-S020

Ph.D 2nd SEMSTER

DEPARTMENT OF EDUCATION HAZARA UNIVERSITY MANSEHRA


What Is a T-Test?
A t-test is a type of inferential statistic used to determine if there is a significant difference
between the means of two groups, which may be related in certain features. It is mostly used
when the data sets, like the data set recorded as the outcome from flipping a coin 100 times,
would follow a normal distribution and may have unknown variances. A t-test is used as a

Explaining the T-Test


Essentially, a t-test allows us to compare the average values of the two data sets and determine if
they came from the same population. In the above examples, if we were to take a sample of
students from class A and another sample of students from class B, we would not expect them to
have exactly the same mean and standard deviation. Similarly, samples taken from the placebo-
fed control group and those taken from the drug prescribed group should have a slightly different
mean and standard deviation.

Mathematically, the t-test takes a sample from each of the two sets and establishes the problem
statement by assuming a null hypothesis that the two means are equal. Based on the applicable
formulas, certain values are calculated and compared against the standard values, and the
assumed null hypothesis is accepted or rejected accordingly.

If the null hypothesis qualifies to be rejected, it indicates that data readings are strong and are
probably not due to chance. The t-test is just one of many tests used for this purpose. Statisticians
must additionally use tests other than the t-test to examine more variables and tests with larger
sample sizes. For a large sample size, statisticians use a z-test. Other testing options include the
chi-square test and the f-test.

When to use a t-test


A t-test can only be used when comparing the means of two groups (a.k.a. pairwise comparison).
If you want to compare more than two groups, or if you want to do multiple pairwise
comparisons, use an ANOVA test or a post-hoc test.

The t-test is a parametric test of difference, meaning that it makes the same assumptions about
your data as other parametric tests. The t-test assumes your data:

1. are independent
2. are (approximately) normally distributed.
3. have a similar amount of variance within each group being compared (a.k.a. homogeneity
of variance)

If your data do not fit these assumptions, you can try a nonparametric alternative to the t-test,
such as the Wilcoxon Signed-Rank test for data with unequal variances.

What type of t-test should I use?


When choosing a t-test, you will need to consider two things: whether the groups being
compared come from a single population or two different populations, and whether you want to
test the difference in a specific direction.
One-sample, two-sample, or paired t-test?

 If the groups come from a single population (e.g. measuring before and after an
experimental treatment), perform a paired t-test.
 If the groups come from two different populations (e.g. two different species, or people
from two separate cities), perform a two-sample t-test (a.k.a. independent t-test).
 If there is one group being compared against a standard value (e.g. comparing the acidity
of a liquid to a neutral pH of 7), perform a one-sample t-test.

One-tailed or two-tailed t-test?

 If you only care whether the two populations are different from one another, perform
a two-tailed t-test.
 If you want to know whether one population mean is greater than or less than the other,
perform a one-tailed t-test.

In your test of whether petal length differs by species:

 Your observations come from two separate populations (separate species), so you
perform a two-sample t-test.
 You don’t care about the direction of the difference, only whether there is a difference, so
you choose to use a two-tailed t-test.

Performing a t-test
The t-test estimates the true difference between two group means using the ratio of the difference
in group means over the pooled standard error of both groups. You can calculate it manually
using a formula, or use statistical analysis software.

T-test formula
The formula for the two-sample t-test (a.k.a. the Student’s t-test) is shown below.

In this formula, t is the t-value, x1 and x2 are the means of the two groups being compared, s2 is
the pooled standard error of the two groups, and n1 and n2 are the number of observations in each
of the groups.

A larger t-value shows that the difference between group means is greater than the pooled
standard error, indicating a more significant difference between the groups.

You can compare your calculated t-value against the values in a critical value chart to determine
whether your t-value is greater than what would be expected by chance. If so, you can reject the
null hypothesis and conclude that the two groups are in fact different.

T-test function in statistical software


Most statistical software (R, SPSS, etc.) includes a t-test function. This built-in function will take
your raw data and calculate the t-value. It will then compare it to the critical value, and calculate
a p-value. This way you can quickly see whether your groups are statistically different.

In your comparison of flower petal lengths, you decide to perform your t-test using R. The code
looks like this:

t.test (Petal.Length ~ Species, data = flower.data)

T-Test Assumptions

1. The first assumption made regarding t-tests concerns the scale of measurement. The
assumption for a t-test is that the scale of measurement applied to the data collected
follows a continuous or ordinal scale, such as the scores for an IQ test.
2. The second assumption made is that of a simple random sample, that the data is collected
from a representative, randomly selected portion of the total population.
3. The third assumption is the data, when plotted, results in a normal distribution, bell-
shaped distribution curve.
4. The final assumption is the homogeneity of variance. Homogeneous, or equal, variance
exists when the standard deviations of samples are approximately equal.

T-test applications
 The T-test is used to compare the mean of two samples, dependent or independent.
 It can also be used to determine if the sample mean is different from the assumed mean.
 T-test has an application in determining the confidence interval for a sample mean.

References and Sources


 R. Kothari (1990) Research Methodology. Vishwa Prakasan. India.
  https://fliphtml5.com/zurx/kuaw/basic/201-250
 https://www.investopedia.com/terms/o/one-tailed-test.asp
 https://towardsdatascience.com/hypothesis-testing-in-machine-learning-using-python-
a0dc89e169ce
 https://en.wikipedia.org/wiki/Two-tailed_test
 https://www.scribbr.com/statistics/t-test/
 https://www.scalelive.com/null-hypothesis.html

You might also like