Teach you how to do independent t-test

1. Case introduction

In order to study the hypoglycemic effect of four types of domestic new drug Acarbose Capsules, a randomized controlled trial was conducted in a hospital with 40 patients with type 2 diabetes mellitus. The researchers randomly divided these patients into the experimental group (using Acarbose capsules) and the control group (using Baitangping capsules), and measured the fasting blood sugar before the start of the test and at the 8th week of the test, and the calculated fasting blood sugar decreased. See Figure 1 for the values:

figure 1

2. Problem analysis

The experiment completely randomly assigns the subjects to two different treatment groups, so this experiment is a comparison of two-sample means in a completely random design. An independent sample t-test can be used for analysis to investigate whether the means of the two populations represented by the means of the two samples are equal.

There are three prerequisites for the use of independent samples t-test:

Condition 1: Independence—the observations are independent of each other; for example, in this case, each test object is independent and there is no mutual interference.

Condition: 2: Normality - both sets of data need to meet normality;

Condition 3: Homogeneity of variances - the variances of the two populations corresponding to the two samples are equal.

Condition 1 Independence is mainly judged on the basis of professional knowledge in practice. Condition 2 normality requires normality testing for each group of data; condition 3 homogeneity of variance also requires hypothesis testing.

3. Software operation and result interpretation

(1) Normality test

1. Theoretical explanation

Commonly used methods for normality testing include graphic method, kurtosis skewness calculation method, and statistical test method. Among them, the most stringent is the statistical test method, which is used in this case to carry out the normality test.

The Shapiro-Wilk test was proposed by SSShapiro and MBWilk in 1965 to use the order statistic W to test the normality of the distribution. It is often used for the normality test of small sample data, and it is usually used when 3≤n≤50. The data in this case are all less than 50, so the SW test was used for analysis.

: The population follows a normal distribution

: The population does not follow a normal distribution

The formula for calculating the test statistic W is:

Among them, is the i-th observation value after sorting the n observation values ​​in ascending order, and is the coefficient. After calculating the W value, look up the table to get the corresponding p value. When P>0.05, the null hypothesis was not rejected, and the data were considered to obey the normal distribution.

2. Software operation

Normality tests were performed using statistical software. Organize the data into the format shown in Figure 2, where a row represents a sample and a column represents an indicator.

figure 2

Upload the data to the SPSSAU online data analysis software, select [Normality Test], put "Fasting Blood Glucose Drop Value" into the analysis item (quantitative) box on the right, and put "Group" into the grouping item (classification) box. The operation is as shown in Figure 3:

image 3

3. Interpretation of results

The output normality test results of SPSSAU are as follows:

Figure 4

The normality test was carried out for the drop of fasting blood sugar. It can be seen from Figure 4 that the drop of fasting blood sugar of the test group X1 and the control group X2 did not show significance (p>0.05), which means that the null hypothesis is not rejected, and the fasting blood sugar drops All the values ​​have normality characteristics, that is, the two sets of data obey the normal distribution.

Next, test whether the variances of the two populations corresponding to the two samples are equal.

(2) Homogeneity of variance test

1. Theoretical explanation

If the variances of the two populations are equal, the t-test can be used directly; if the variances of the two populations are not equal, methods such as non-parametric testing or variable transformation can be used for analysis. The F test can be used to determine whether the variances of the two populations are equal. The formula for calculating the test statistic F is as follows:

where is the larger sample variance and is the smaller sample variance, the numerator degrees of freedom are , and the denominator degrees of freedom are . After obtaining the F value, look up the table to obtain the p value.

2. Software operation

The homogeneity of variance test was performed using SPSSAU software. Select [Analysis of Variance], put "Fasting Blood Glucose Drop Value" into the Y (quantitative) box on the right, put "Group" into the X (categorical) box, pull down and select the homogeneity of variance test, and the operation is as follows:

Figure 5

3. Interpretation of results

The results of homogeneous variance test of SPSSAU output are shown in Figure 6:

Figure 6

It can be seen from Figure 6 that all the samples of different groups will not show significance for the drop of fasting blood sugar (p>0.05), which means that the volatility of the sample data of different groups is consistent, and through the variance Homogeneity test, that is, the variances of the two populations corresponding to the two samples are equal.

To sum up, the two sets of data are floating and filled with normal distribution, and the variances of the two populations corresponding to the two samples are equal, so you can safely use the independent sample t test for analysis.

(3) Independent sample t-test

1. Theoretical explanation

When the variances of the two populations are equal,

The t-test statistic is constructed as follows:

After obtaining the t value, look up the table to obtain the corresponding p value. When p>0.05, the null hypothesis is not rejected, and the difference between the two groups of data is considered to be not statistically significant.

2. Software operation

Use SPSSAU to perform independent sample t-test, select [t-test], put "Fasting blood sugar drop value" into the Y (quantitative) box on the right, put "group" into the X (categorical) box, and operate as shown in the figure below 7:

Figure 7

3. Interpretation of results

SPSSAU output independent sample t test analysis results are as follows:

Figure 8

As can be seen from the above table, use the independent sample t-test to study the difference between the test group X1 (using Acarbose capsules) and the control group X2 (using Baitangping capsules) on the drop in fasting blood sugar, and get p=0.525>0.05, Therefore, the null hypothesis is not rejected, that is, the difference is not statistically significant. Therefore, it cannot be considered that the four domestic new drugs, Acarbose Capsules and Baitangping Capsules, have different hypoglycemic effects.

4. Conclusion

In this study, the independent sample t-test was used to determine whether there were differences in the hypoglycemic effects of the four domestic new drugs, Acarbose Capsules and Baitangping Capsules. Through professional knowledge, it is judged that the two sets of data are independent of each other and do not interfere with each other; through the Shapiro-Wilk test, it is known that the two sets of data obey the normal distribution; through the F test, it is known that the two sets of data meet the variance homogeneity, so independent samples are used The t test was used for difference analysis.

The results of the study showed that the blood sugar-lowering effect of the four domestic new drugs, Acarbose Capsules, was 2.065±3.060, and that of Baitangping Capsules was 2.625±2.420. Although there seems to be a difference, the test results p>0.05, indicating that there is no statistical difference Therefore, it cannot be considered that the four domestic new drugs, Acarbose Capsules and Baitangping Capsules, have different hypoglycemic effects.

5. Knowledge Tips

1. The group of X can only be two groups?

The principle of the t test is to compare two sets of data, so the data of X can only and must include two numbers. If there are three groups in X, such as under-graduate, undergraduate and above; at this time, the t-test cannot be used, and variance analysis needs to be used for difference research.

2. Is the normality test necessary?

The t-test has a certain tolerance to the non-normality of the data. If the data basically meets the normal distribution (for example, the histogram basically meets the bell-shaped distribution shape of "high in the middle and low on both sides"), the result is still robust. In practice, judgment is mainly based on professional knowledge, especially when the number of cases in each group is small. Some medical indicators, such as height, weight, white blood cells, red blood cells, hemoglobin, blood pressure, etc., obey normal distribution, and normality test is not necessary for these indicators. When necessary, a normality test can also be performed on the data.

3. What should I do if the variances are not satisfied?

When the data does not satisfy the homogeneity of variance, the impact on the conclusion is relatively large. At this point, variables can be transformed or analyzed using the SPSSAU nonparametric test. The method of operation is the same as the independent sample t test.

Guess you like

Origin blog.csdn.net/m0_37228052/article/details/130948815