StatCrunch logo (home)

< StatCrunch Examples
Conducting hypothesis tests for the difference between two proportions with raw data
This tutorial covers the steps for conducting hypothesis tests for the difference between two proportions in StatCrunch. To begin, load the Top US Problems data set, which will be used throughout this tutorial. This data set comes from a Gallup survey taken in July and August 2014 which asked 945 Republicans and 854 Democrats to name the biggest problem for the United States. The Party column contains the respondent's party affiliation, either Republican or Democrat. The Response column contains the top problem identified by the respondent. Only the top four responses are tabulated here: Immigration, Dysfunctional Government, Economy and Unemployment. The remaining responses are listed as Other. To compare two proportions using the corresponding summary data, see Conducting hypothesis tests for the difference between two proportions with summary data.
Performing a two-sample proportion hypothesis test
Is there a significant difference between the proportion of Republicans and the proportion of Democrats that identify "Immigration" as the top problem? This can be tested by conducting a hypothesis test for the difference between the two proportions. To compute the appropriate two-sample proportion hypothesis test, choose the Stat > Proportion Stats > Two Sample > With Data menu option. Select the Response column for Values in under both Sample 1 and Sample 2. The Success input is used to define the outcome of interest. In this case, set this value to Immigration under both Sample1 and Sample2. For Sample1, set Where to Party = Republican to limit the respondents in the first sample to Republicans. For Sample2, set Where to Party = Democrat to limit the respondents in the second sample to Democrats. Make sure to type this statement accurately as such expressions are case sensitive. These statements can also be created by clicking on the adjoining Build buttons, which opens a custom expression builder. Under Perform, the Hypothesis test for p1 - p2 is selected by default. Leave the null value at 0 to directly compare the two proportions. The alternative hypothesis can be changed to > or < , but for this scenario leave the alternative hypothesis at since the goal is to detect any type of difference. Click Compute! to view the hypothesis test results. The hypothesis test output includes the difference of the observed sample proportion of Immigration responses between Republicans and Democrats, the test statistic (labeled as Z-Stat) and the P-value.

Always Learning