Step 1: Conducting and interpreting the results from the difference in means test

To do a difference in means test, you need a binary independent variable and a dependent variable that is measured at the ordinal, interval, or ratio level. Be sure that you have transformed any nominal-level variable with more than two categories into a binary variable. For the example below, we will use the examples presented in Chapter 8. The first assesses the relationship between biological sex (DP1) and attitudes about whether political violence is ever justifiable (DP62). Keep in mind that no research population has been specified for the examples below.

For the difference in means test in Stata, type the following and then press enter

ttest DP62, by(DP1) welch

These results provide the number of observations and average for DP62 for each category (1 – men and 2 – women). Here we see that the average for Justifiable: Political Violence for men is 3.41 and for women the average is 2.90. Since the variable runs from 1 (never justifiable) to 10 (always justifiable), we see that the average for both men and women falls more toward the lower values (i.e. towards ‘never justifiable’), but there is still a difference between men and women. Specifically, the average for men is higher than it is for women. We can find the actual value of this difference where “Mean” and “diff” meet in the table, .506. There is thus a half point difference between men and women for the Justifiability of Political Violence, with women leaning more towards ‘never justifiable.’

But is this result significant? To find the test’s p value, look at the value under the Ha: diff ! = 0 in the middle column at the bottom of the results (Ha means alternate hypothesis – here we estimating the probability of getting a difference as large as the one generated by the test when the true difference in the population is zero); the value under Ha: diff !=0 is thus the test’s p value, which tells us if the result is statistically significant. Here we see that the p value for the test is .0049. This means that in about 5 out of 1,000 times we would see a result this large (a mean difference of .506 between men and women) by chance if we were to do the same test using samples similar to the one in the DatapracStata. As a result, since this p value is below the standard of .05, we can reject the null hypothesis that the mean difference between the two groups (men and women) is actually zero. Rather, the test provides evidence that there is a significant difference between the two groups and how they think about the justifiability of political violence.

Let’s work with the other example in the text: is there a difference between people in different social classes and whether they believe that people receiving state aid for unemployment is an essential characteristic of democracy (DP65). Before we can conduct this test, we need to transform the social status variable in the DatapracStata into a binary variable with only two categories. (See Chapter 7 for this: 1 – working class, 2 – lower class, and 3 – lower middle class were combined into one category, while 4 – upper middle class and 5 – upper class were combined into a second category.) Now that it is a binary variable (lower classes vs. upper classes), we can use it in the difference in means test.

Type the following and then press enter:

ttest DP65, by(socialstatusbinary) welch

The test produces the following results:

Looking at these results, we see that the lower classes (N=614) have an average of 6.31 on opinions concerning whether people receiving state aid for unemployment is an essential characteristic of democracy, while the upper classes (N=417) have an average of 6.41. The mean difference between the two groups is -.102. While this number is not zero, it is admittedly small. To determine if this result could be due to random chance (when the true difference is really zero), we consult the test’s p value (in the middle column under Ha: diff!=0) , which is in this case is .549. This means that if we could conduct this same test on samples like the one used in the DatapracStata, in almost 55 of 100 times, we would get a result this large if the true difference between the lower and upper classes were really zero. Since this p value is well above the threshold of .05, we cannot reject the null hypothesis and the result is insignificant.

Step 2: Producing and interpreting a correlation coefficient

The correlation coefficient is used to assess the relationship between two variables with ordinal, interval, or ratio-level measurement. Here we will produce the correlation coefficient between age (DP2) and perceptions concerning corruption in the United States (DP58) for the research population of younger Americans. To do this in Stata, type in the following and press enter:

pwcorr DP2 DP56, sig

This produces the following results:

This small table displays both the correlation coefficient between the two variables (DP2 and DP56) and the test’s p value. The correlation coefficient is in the first box in the second row, +.218. (Note that a variable correlated to itself produces a correlation coefficient of 1.) The positive number means that as age increases, views on corruption also increase (moving toward the value of 10, which represents ‘there is abundant corruption in the United States). On the surface, this appears to confirm the researcher’s hypothesis. But is this correlation coefficient significant, in other words, can we reject the null hypothesis that the true correlation between these variables in the population from which the DatapracStata was generated is actually zero? To answer this question, we must look at the value under the correlation coefficient of .218 (which is how the p value is displayed in Stata). Here we see that the p value is .000, which means that there is a 0 in 1,000 probability that this result is due to random chance. In other words, the result was achieved because there is a very low probability that the true population correlation for these two variables is zero. This means we can reject the null hypothesis; the test suggests that there is likely a positive correlation between age and perceptions of corruption in the population from which the DatapracStata sample was generated. Also, you need to know how your variables are measured in order to interpret these statistics properly; specifically knowing how the perceptions of corruption variable is measured from 1 to 10 is crucial to interpret the positive correlation coefficient appropriately (especially since variables concerning age are usually straightforward from younger to older people).

Let’s consider the next two examples concerning the correlation coefficient in the text. First, consider the relationship between age (DP2) and views on whether it is ever justifiable for someone to accept a bribe in the course of their duties (DP60). The researcher believes that older respondents will be more likely to believe that is not justifiable to accept a bribe compared to younger respondents.  Since the justifiability variables run from 1 (never justifiable) to 10 (always justifiable), the researcher is expecting a negative number for the correlation coefficient, which would imply an inverse correlation.

To generate this new correlation coefficient, type in the following and press enter:

pwcorr DP2 DP60, sig

This produces the following results:

Here we see the correlation coefficient is indeed negative, suggesting that as age increases, the values on whether it is justifiable for someone to accept a bribe in the course of their duties decrease, towards never justifiable. This is in line with the research hypothesis. But is this result significant? The p value for the test (found under the correlation coefficient) is .000. Well below the threshold of .05, this p values suggests that the true correlation between these two variables in the population from which the DatapracStata was derived is not zero. Rather, the very low p value provides evidence that there is an inverse correlation between age and views on whether it is justifiable for someone to accept a bribe in the course of their duties, and specifically that as age increases, respondents find it less justifiable to accept a bribe. Again, knowing how the variables are measured is very important to interpreting these statistics properly.

Let’s go through the last example from the text, the correlation between age (DP2) and how important God is in people’s lives (DP72). The researcher believes that as age increases, respondents will be more likely to believe that God is very important. Since the importance of God in life variable runs from 1 (not at all important) to 10 (very important), he is expecting a positive correlation. The results from the test are below:

Type the following and press enter:

pwcorr DP2 DP72, sig

This produces the following results:

The correlation between age and how important God is in life is .047. While the number is positive (suggesting a positive correlation between the two variables), we see that this number is very close to 0. And indeed the p value for the test is .135, which is well above the threshold of .05. As a result, the null hypothesis that the true correlation between these variables cannot be rejected; rather the results suggest that the null hypothesis is indeed true for the population from which the DatapracStata was taken.

 

Back to top