The 2-PropZInt( command calculates a confidence interval for the difference between two proportions, at a specific confidence level: for example, if the confidence level is 95%, you are 95% certain that the difference lies within the interval you get. The command assumes that the sample is large enough that the normal approximation to binomial distributions is valid: this is true if, in both samples involved, the positive and negative counts are both >5.
The 1-PropZInt( command takes 5 arguments. The first two, x,,1,, and n,,1,, are the positive count and total count in the first sample (so the estimated value of the first proportion is x,,1,, out of n,,1,,. The next two arguments, x,,2,, and n,,2,,, are the positive count and total count in the second sample.
The output gives you a confidence interval of the form (a,b), which is the range of values for the difference π,,1,,-π,,2,, (where π,,1,, and π,,2,, are the first and second proportions respectively). If you were looking for the difference π,,2,,-π,,1,, all you have to do is switch two sides and negate the numbers in the interval.
You want to compare the proportion of students at your school and at a friend's school. that support a particular political candidate. You take a random sample of 50 students, and find that 22 of them support that candidate. Your friend took a random sample of 75 students at his school, and found that 28 supported the candidate.
The first proportion is the proportion of supporters at your school. 22 out of 50 students support the candidate, so x,,1,,=22 and n,,1,,=50. The second proportion is the proportion of supporters at your friend's school. 28 out of 75 students support the candidate, so x,,2,,=28 and n,,2,,=75. If you decided to do a 95% confidence interval, you would add the argument 95 after all these, so the syntax would be as follows:
:2-PropZInt(22,50,28,75,95 which can also be :2-PropZInt(22,50,28,75,.95
The output if you run the above code will look approximately like this:
1-PropZInt (-.1092,.24249) p1=.44 p2=.3733333333 n1=50 n2=75
This tells you that between about the difference betwen the proportions is between about -0.11 (your school's proportion being about 0.11 less than your friend's school's proportion) to about 0.24 (your school's proportion being about 0.24 greater than your friend's school's proportion).
If the confidence level is 95%, you can omit the final 95, since that is the default value:
:2-PropZInt(22,50,28,75,95 can be :2-PropZInt(22,50,28,75
- ERR:DOMAIN is thrown if either proportion is not between 0 and 1, or x,,i,, is negative or greater than n,,i,,, or the confidence level is negative or at least 100.