 SPSS TUTORIALS BASICS ANOVA REGRESSION FACTOR CORRELATION

# Z-Test and Confidence Interval Proportion Tool There's two basic tests for testing a single proportion:

For larger samples, these tests result in roughly similar p-values. However, the binomial test only comes up with a 1-tailed p-value unless the hypothesized proportion = 0.5. Moreover, it can't compute a confidence interval for your proportion.
The z-test does not have these 2 limitations and is among the more widely used statistical tests. Very oddly, however, it's absent from SPSS. Plenty of reasons for us to present this very simple tool in the remainder of this tutorial.

## Installation 1. This tool requires SPSS version 18 or higher with the SPSS Python Essentials properly installed and tested.
3. For SPSS versions 18 through 22, select Utilities Extension Bundles Install Extension Bundle. For SPSS 24, select Extensions Install Local Extension Bundle.
Navigate to the confidence intervals extension (its file name ends in “.spe”, short for SPSS Extension) and install it.
4. Although you'll get a popup that the extension was successfully installed, it'll only work after you close and reopen SPSS entirely (unless you're on version 24).
5. You'll now find the tool under Utilities Confidence Interval Proportion.

## Operations

1. The test variables must have exactly two valid values. Variables violating this requirement will be skipped when calculating results.
2. The test variables may be any mixture of numeric and string variables.
3. The p-values and confidence intervals are based on the central limit theorem. This approximation is sufficiently accurate if p0*n and (1-p0)*n >5 where p0 denotes the population proportion under H0 and n is its related sample size.1 If this does not hold for one or more variables, a note will be added to the results.
4. If any SPLIT FILE is in effect, the tool will switch if off, throw a warning that it did so and then proceed as usual.
5. If a WEIGHT variable is in effect, results will be based on rounded frequencies. P-values may be biased if you're using non integer sampling weights but this holds for all p-values in SPSS except for those from the complex samples module.2,3,4

## Example

We'll now test our tool on test.sav, part of which is shown below. Our null hypothesis is that the population proportions of all dichotomous variables = 0.5. ## Data Inspection

We'll run a quick data check with FREQUENCIES to see if we need to specify any user missing values. This happens to be the case so we'll do just that.

*Show value and value labels in output.

set tnumbers both.

*Basic frequency tables.

frequencies q1 to passes.

*Set missing values.

missing values q1 to q4 (2).

*Show only value labels in output.

set tnumbers labels.

## Result ## Computing our Confidence Intervals

We'll go to Utilities Confidence Interval Proportion and fill out the main dialog as below.  Note that TO may be used for a range of variable names. Clicking results in the syntax below.

*Note: requires confidence interval proportion tool to be properly installed in order to run.

CONFIDENCE_INTERVAL_PROPORTION VARIABLES = 'q1 to passes' TESTPROP = 0.5 LEVEL = 95.

## Results

Running our syntax results in a new dataset holding our results. Note that most variables have variable labels explaining their precise meaning. You can see them in variable view or hover over a variable’s name in data view as shown in the screenshot below. We find back our (valid) frequencies in these results. Each test variable has in 2 rows, one for each value. You'll probably need just one of these rows but this configuration circumvents the need for specifying test values for each variable. We simply test both -whatever they may be. Further right we find our z-test. Its p-value indicates the probability of finding the observed sample proportions if its population counterpart is exactly equal to the test proportion. Note that a continuity correction has been used for computing the z-values and their associated p-values. Finally, the last variables in our results hold our confidence intervals and -possibly- some notes on the results.

## Reporting Examples

Obviously, include your sample proportions and sample size in your report. Regarding the z-tests, we'll write something like “the proportion of people who answered q1 correctly did not differ from 0.5, as indicated by a z-test: z = 1.59, p = 0.11.”or “A z-test showed that more than 50% of our population answers q2 correctly, z = 2.0, p = 0.046.”

Thanks for reading, hope you'll like it!

## References

1. Van den Brink, W.P. & Koele, P. (2002). Statistiek, deel 3 [Statistics, part 3]. Amsterdam: Boom.
2. Fowler, F.J. (2009). Survey Research Methods. Thousand Oaks, CA: SAGE.
3. De Leeuw, E.D., Hox, J.J. and Dillman, D.A. (2008). International Handbook of Survey Methodology. New York: Lawrence Erlbaum Associates.
4. Kish, L. Weighting for Unequal Pi. Journal of Official Statistics, 8, 183-200.

# Tell us what you think!

*Required field. Your comment will show up after approval from a moderator.

# THIS TUTORIAL HAS 14 COMMENTS:

• ### By Ruben Geert van den Berg on August 27th, 2020

Hi Lydia!

All of our tools are in Python2.x which doesn't work out of the box with SPSS 27. We should rewrite everything in Python3.x but this is not really on our short term agenda.

A fairly easy solution is to integrate SPSS 27 with Python2.x. Once you do so, you can use all our (and other developers') Python2.x tools. The steps are described here.

Hope that helps!

SPSS tutorials

• ### By Golf on September 27th, 2020

After running the syntax, there is no any new data file come out!! How to solve this problem?

• ### By Neha on June 3rd, 2021

How to compute proportions ( CI ) for variables more than 2 groups ?

• ### By Ruben Geert van den Berg on June 3rd, 2021

Hi Neha!

For (nominal/ordinal) variables defining 3+ groups, we don't usually compute CI's. We usually only use a chi-square goodness-of-fit test in this case.

However, you could break such variables up into dummy variables. Note that we've a great tool for creating those at SPSS Create Dummy Variables Tool.

Hope that helps!

SPSS tutorials