Pharmacy Calculations

Pharmacy Calculations | Comparing Two Means Using the t-test

Comparison of means using the t-test:

Suppose we obtained two sets of replicate measurements – say one from an established method versus a new method or from one analyst versus another and performed basic statistical analysis. The calculated “true” mean values (µ) from two or more sets of measurements may not be exactly the same because of random errors which are always present in an experiment. However, we can establish whether there is a statistically significant difference between two means using a t-test.

Using jargon used in statistics, we could say that we are testing the null hypothesis (H0), which states that the two means from the two sets of replicate measurements are “the same” and that there are no real differences between the means. Any observed differences between the means are due to random errors. The contrary is referred to as the alternative hypothesis (H1). Using the notation used in the previous article for the “true” population mean, H0 and H1 may be expressed as:

H0: µ1 = µ2
H1: µ1 ≠ µ2

The t-test involves the determination of a probability value (p-value) which we compare against a pre-specified α level (significance level – often 0.05). Depending on whether p < α or p > α, we can reject or accept the null hypothesis. Again, we recommend using software to perform statistical analysis. When a p-value is less than or equal to the significance level, we reject the null hypothesis.

Side notes:

  • A statistically significant result (typically a difference is looked at) is a result that is likely not due to chance.
  • You have come across the term confidence level in a previous article. If α is 0.05, 95% is the corresponding confidence level. (Further reading)
  • If one wants to compare more than two population means due to a factor, we do an ANOVA (analysis of variance) calculation. This article will be focused on t-tests for two means.

Statistics Problem:

The fluoride concentration in a toothpaste sample was determined in ppm by two trainee analysts from a calibration curve constructed using an ion-selective electrode (ISE). The two trainees performed the experiment using the same method and obtained their results in quintuplicate.

Trainee 1 (ppm): 1392, 1390, 1390, 1391, 1395.
Trainee 2 (ppm): 1413, 1408, 1406, 1420, 1399.

  • Assess the statistical dispersion of the two datasets and construct a 95% confidence interval.
  • Perform a t-test and assess whether the mean concentration values obtained by the two trainees are different at significance level (α) 0.05.

Side note: In reality, analytical measurements are performed in duplicate or triplicate (or very rarely in quadruplicate and quintuplicate) as doing experiments at sample sizes greater than n = 3 can be time-consuming!


Basic Statistics

Perform basic statistics calculations for the two data sets. We will determine the sample mean (x̄), standard deviation (s), relative standard deviation (RSD)/coefficient of variation (Cv) and construct a 95% confidence interval (CI). You can either use Excel (formulas or descriptive statistics) or perform the calculations by hand.

Both the trainee’s determined fluoride concentration values have low scatter given that the s values are low and Cv <1%. However, the scatter is lower for trainee 1 (Cv = 0.1% versus Cv = 0.6%). Therefore, it can be concluded that trainee 1’s measurements are more precise.

Trainee 1 (µ1): 1391.6 ± 2.6 (2.1) ppm

Trainee 2 (µ2): 1409.2 ± 9.8 (7.9) ppm

Where ± represent 95% CI and s are in parentheses.

How to do the t-test for two means:

For this part, you need to use Excel.

Step 1:

State the null hypothesis (H0). In this case, there is no difference between the mean values of fluoride concentration determined by the two trainees. Any observed differences is due to chance.

Step 2:

Tabulate your data on Excel as shown below. Also include your results from performing basic statistics calculations:

Step 3:

With the data analysis feature enabled, perform a t-Test. Select “t-test: Two-Sample Assuming Unequal Variances”.

Note: You may have noticed that there are two other options for the t-test. In the vast majority of cases in hypothesis testing, population variances are unknown. For this reason, you are more likely to choose the option for unequal variances.

Step 4:

With the “t-test: Two-Sample Assuming Unequal Variances” box opened:

  • Select the columns for the two data sets.
  • Set Hypothesized Mean Difference to 0 as per H0.
  • Set α to 0.05 as per the question.
  • Select an area in the spreadsheet where the results of the calculation will be placed.

Step 5:

A table such as the one shown below should have been generated.

Make conclusions based on the p-value (two-tail).


Given that p < 0.05, we can conclude that the two means determined by the two trainees are significantly different so we reject H0.

Want to learn more about pharmaceutical calculations? Be sure to check out out our other pharmacy calculations articles right now!