# Can SPSS produce Wilson or score confidence intervals for a binomial proportion?

## Problem

I would like to produce Wilson or score confidence intervals for a binomial proportion. Can SPSS do this?

## Resolving The Problem

SPSS has no procedure that will automatically produce Wilson or score confidence intervals for binomial proportions, but it is relatively easy to produce them using COMPUTE commands, as follows. Assuming you have a variable p with the observed proportion, and a variable n with the total number in the denominator, exeecute:

compute score_lower=((p+idf.chisq(.95,1)/(2*n)-idf.normal(.975,0,1)*sqrt((p*(1-p)+idf.chisq(.95,1)/(4*n))/n))) / (1+idf.chisq(.95,1)/n).
compute score_upper=((p+idf.chisq(.95,1)/(2*n)+idf.normal(.975,0,1)*sqrt((p*(1-p)+idf.chisq(.95,1)/(4*n))/n))) / (1+idf.chisq(.95,1)/n).

These produce standard 95% Wilson or score intervals. You can change the .95 values to obtain other coverage levels. Also, it has been recommended by Agresti and Coull (1998) that the following modifications for 1 or n-1 responses be made (these require a variable r, with the number of responses of the total n):

do if r=1.
compute score_lower=-ln(.95)/n.
end if.
do if r=n-1.
compute score_upper=1+ln(.95)/n.
end if.

Reference:

Agresti, A., & Coull, B. A. (1998). Approximate is better than "exact" for interval estimation of binomial proportions. The American Statistician, 52(3), 119-126.

## Related Information

[{"Product":{"code":"SSLVMB","label":"IBM SPSS Statistics"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"Not Applicable","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"Not Applicable","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

48674

Modified date:
16 April 2020

swg21480513