FAQ/spssmix - CBU statistics Wiki
location: FAQ / spssmix

# Testing bimodality in SPSS

Frankland and Zumbo (2002) give examples using the CNLR command in SPSS to fit either two bimodal Normal distributions or one unimodal Normal distribution.

An example SPSS data set is given here. The data comprise a column of frequencies ('observed') pertaining to the observations in the first column ('xout') occurring in intervals [xl,xu] having interval midpoints of xc. Intervals may be of variable length but need to contain at least one observation.

Plotting the above data and then fitting a bimodal model is done using the SPSS syntax below which uses a trapezium rule approximation to estimate Normal probabilities.

```GRAPH
/HISTOGRAM=xout .

compute prop = observed/160.
model program mean1=0 mean2=3 sd1=2 sd2=2 ratio=0.5 c=0.
compute xa = abs(xl-xc).
compute xb = abs(xu-xc).
compute h1 = (0.398942/sd1)*exp(-(((xl-mean1)**2)/(2*sd1**2))).
compute h2 = (0.398942/sd1)*exp(-(((xc-mean1)**2)/(2*sd1**2))).
compute h3 = (0.398942/sd1)*exp(-(((xu-mean1)**2)/(2*sd1**2))).
compute h4 = (0.398942/sd2)*exp(-(((xl-mean2)**2)/(2*sd2**2))).
compute h5 = (0.398942/sd2)*exp(-(((xc-mean2)**2)/(2*sd2**2))).
compute h6 = (0.398942/sd2)*exp(-(((xu-mean2)**2)/(2*sd2**2))).
compute predbi = ratio*(0.5*(h1+h2)*xa + 0.5*(h2+h3)*xb)
+ (1-ratio)*(0.5*(h4+h5)*xa + 0.5*(h5+h6)*xb)+c.
cnlr prop /pred = predbi
/bounds sd1 gt 0.0001;
sd2 gt 0.0001;
1.0 ge ratio ge 0.0
/save = predbi residbi.```

The resulting estimates of 2.39 (0.60) and 4.99 (0.50) for the means (sds) are close to the means (sds) if 2.5 (0.5) and 5 (0.5) used to generate the data. The mixing proportion of 0.53 is also close to the mixing proportion used which was 0.5 so the data is equally divided between the two Normal distributions. The fit is, as expected, close as show here.

Care should be taken with the choice of starting parameter estimates for the means and sds as this can lead to non-optimal solutions with small R-squareds and lack of shape compared to the best fitting solution. The authors also show how to find the best fitting unimodel Normal distribution using a similar approach.

Reference

Frankland BW and Zumbo BD (2002) Quantifying bimodality Part I: An easily implemented method using SPSS. Journal of Modern Applied Statistical Methods 1(1) 157-166.

None: FAQ/spssmix (last edited 2013-03-08 10:17:19 by localhost)