In the past few articles, we have introduced the basic operations of comparison between groups, normality test and variation homogeneity test. Today's article will introduce the most commonly used t-tests: independent sample t-test, single-sample t-test and paired-sample test, and give examples of how to use JMP to complete the analysis.
Three common typesttest
The t-test is mainly used to test whether a certain sample statistic is equal to the population parameter. In practical applications, there are three most common scenarios: independent sample t-test, paired sample t-test and single-sample t-test.
- Independent samples t test: used to test whether there is a statistical difference between the means of two independent samples
- One-sample t test: used to compare whether there is a statistical difference between sample data and a specific value
- Paired t test: used to test whether there is a statistical difference between the means of paired samples.
This article mainly uses two data, one is the physical health score data (Figure 1), and the other is the skin moisture content data (Figure 2).

Figure 1 Physical health score data

Figure 2 Skin moisture content data
1. Independent samplettest
The so-called independent samples mean that the populations from which the samples come are independent of each other. For example, in the comparison of two groups of physical health scores, Zhang San's score has no relationship with Li Si's score, and they are independent of each other.
Example 1: In the physical health score data, we want to compare whether there are differences in physical health scores between smokers and non-smokers.
First, click "Analyze" → "Fit Y with X" in the JMP menu to bring up the interface for comparison of differences between groups (Figure 3).

Figure 3 Independent sample t calibration operation—function menu selection
In this example, the physical health score is the result and smoking is the group, so put the physical health score into "Y, response" and smoking into "X, factor" in the dialog box (Figure 4).

Figure 4 Independent sample t test operation—variable selection
The results are shown in Figure 5.
If you have read the article in the previous issue, you should know that although Figure 5 does not have any statistical results, we can display the statistical analysis results we need by clicking the red triangle button in the upper left corner. The selection of these results requires Judgment is based on the normality and homogeneity of variation in the data.
The test results show that the data is normally distributed and the variation numbers are homogeneous, so the independent sample t test can be considered.

Figure 5 Output result diagram
Click the red triangle button next to the "Smoking-Physical Health Score" single factor analysis and select "Mean/Variation Analysis/Merge t (Figure 6)" in the drop-down menu.

Figure 6 Independent sample t calibration operation—method selection
The results are shown in Figure 7. The t value (that is, the t ratio in the result) is 0.696. At the same time, the result gives 3 P values, namely: probability>|t|, probability>t and probability |t| represents the two-sided P value, which is what we most often report, probability > t and probability
The results showed that there was no statistically significant difference in physical health scores between smokers and non-smokers.

Figure 7 Independent sample t test results
If the data in this example satisfies normality but the two sets of variables are not homogeneous, the corrected t test (Satterthwaite t test) can be used. Click the red triangle button on the left side of the "Smoking-Physical Health Score" single factor analysis (Figure 8) and select "t-test" in the drop-down menu to obtain the results of the corrected t-test.
The display form and interpretation of the results are the same as the t test in Figure 7.

Figure 8 Selection of correction t calibration
**Note here:
Among the JMP options, "t test" outputs the result of the corrected t test, while the "mean/variance analysis/combined t" selection outputs the result of the t test. Please avoid making mistakes when doing analysis.
2. Single samplettest
The one-sample t test is usually used to test whether there is a statistical difference between the mean of a set of data and a specified target value. If you want to know whether the mean red blood cell value of a specific professional athlete is statistically different from the standard red blood cell value.
Example 2: In the physical health score data, assuming that the normal value of the physical health score is 60, we want to know whether there is a difference between the patient's physical health score and the normal value of the healthy population.
The data in this study are normally distributed, and the single-sample t test can be considered.
Since the one-sample t-test does not have a group factor, it is not completed in the "Fit Y with X" menu, but in the "Distribution" menu.

Figure 9 Single sample t calibration - function table selection
Select "Analyze → Distribution" (Figure 9). In the interface of Figure 10, put the physical health score into the "Y, column". Click OK to enter the results interface (Figure 11).

Figure 10 Single sample t test - variable selection
Click the red triangle button on the left side of the physical health score and select "Calibration Mean" in the drop-down menu (Figure 11). The "mean" here is the target value we need to specify.

Figure 11 Single sample t test - method selection
Fill in 60 in the specified hypothesis mean value in the pop-up dialog box (Figure 12), that is, to test whether there is a statistical difference between the mean physical health score of the sample population and the target value of 60. If the standard deviation is known, you can also enter the standard deviation in Figure 12. If it is unknown, it is estimated based on the sample data.

Figure 12 Single sample t test - specifying target value
The results are shown in Figure 13 below, indicating that the difference is statistically significant (t=-5.7130, p<0.0001).

Figure 13 Single sample t test results
3. Paired t test: Comparison of two sets of paired data
The opposite of the concept of independent samples is paired samples, that is, the samples are not independent. For example, the blood pressure values of a certain hypertensive group before and after treatment. For Zhang San, there will be a certain relationship between the blood pressure values before and after treatment. If it was 180 before treatment, it is usually unlikely to suddenly drop to 120 after treatment, and it is likely to be slightly lower than 180.
Example 3: In the water content data, it is planned to explore whether there is a difference in the skin moisture content of patients before and after intervention. Since this study explores whether there are differences in the examination results of the same batch of patients at different time points, it belongs to paired data. If the data obeys the normal distribution, the paired t test will be used. If the normal distribution is not satisfied, the non-parametric paired test will be used. The non-parametric test will be introduced in detail in subsequent chapters.
The statistical analysis idea of the paired t test is to calculate the difference before and after the intervention, and compare the mean value of the difference with 0 to obtain whether the difference before and after the intervention is statistically significant. Therefore, when importing paired data in JMP, you should pay attention to the import format as shown in Figure 2. The two measured values of each patient are in the same row and two columns, so that the difference in the measured values of each patient can be calculated. value.
The paired t test is implemented not in the "Fit Y by X" menu, but under the "Professional Modeling" menu. Select "Analysis→Professional Modeling→Pairing" (Figure 14).

Figure 14 Pairing t test - menu selection
A reminder here: This article uses JMP 15 as an example. In different JMP versions, the location of the pairing menu may be different. In early JMP software, the "Pairing" module can be found directly under the "Analysis" option. .
In the paired t test, at least two outcome variables are required. In this case, they are skin moisture content (before intervention) and skin moisture content (after intervention). Put these two variables into "Y, paired response" (Figure 15) . When JMP calculates the paired t test, the variables in the second row are subtracted from the variables in the first row by default. When operating, you need to pay attention to the order of the variables.
As shown in Figure 15, pre-intervention is in row 1 and post-intervention is in row 2, so the results are based on post-intervention - pre-intervention. In this case, we want to know whether the skin moisture content has increased after intervention, so we first put the skin moisture content (before intervention), and then put the skin moisture content (after intervention).

Figure 15 Paired t test - variable selection
The paired t test results are shown in Figure 16. The results first give the calculation method of the difference as skin moisture content (after intervention) - skin moisture content (before intervention). The results section gives the mean values before and after intervention, and the mean difference is 6.32, indicating that after intervention The skin moisture content was higher than before the intervention, and the skin moisture content increased by an average of 6.32%. The difference in skin moisture content of patients before and after intervention was statistically significant (t=12.595, p<0.0001).

Figure 16 Paired t test results
The above are the three common t-test application scenarios, application ideas and analysis precautions based on JMP brought to you in this issue. In subsequent articles, we will successively bring you variation analysis and pairwise comparison, rank sum test and its pairwise comparison, chi-square test and trend test. Stay tuned!
Original text: Yiwen learned 3 common methods of t test