Stupid SPSS question: proportions
March 18, 2013 11:17 AM   Subscribe

I never use SPSS (I hate it like I hate nothing else, except perhaps Excel) but I must use SPSS for this problem. Normally I'd just use R and be done with it, but SPSS is necessary for this problem. How can I get a simple error bar plot from two proportions?

I have a 2x2 contingency table. For simplicity, suppose I have two coins; I flip Coin A 150 times and I flip Coin B 76 times. Coin A comes up heads 80 times; Coin B comes up heads 40 times. I want two bars (or points), side by side -- one for each coin -- that represent the corresponding proportion of heads. I also want error bars on them (that is, sqrt(p(1-p)/N), the standard error of a proportion). I do not want a stacked bar plot, and I do not want two plots of two bars each. This is a very simple, common plot (example here), but I just cannot figure out how to create it in SPSS. The interface is incomprehensible to me.

I must use SPSS, and cannot use syntax.
posted by Philosopher Dirtbike to Computers & Internet (5 answers total)
I don't have SPSS open right now so I can't check if this is exactly how you do it, but it's worth giving it a try.

I think you have to get to 'Legacy Dialogues,' and select graph bar. Click 'define' and in the next window that pops up, click 'options' and check off 'display error bars.'
posted by cyml at 11:42 AM on March 18, 2013

The answer will differ slightly depending on which release of SPSS you're working with, but basically:

1. You'll want two variables in your SPSS file (let's call them Coin & Result), with 226 rows. Coin should have 150 1's and 76 2's; of the 150 1's (the tosses of Coin A), you'll want 80 to have '1' for Result (the heads), and the other '76' to have '0'; for the 76 2's (representing the tosses of Coin B), you'll want 40 1's and 36 0's.

2. In the variable view, make sure that Coin is a nominal variable, and Result is an Interval variable

3a. If you have an old release of SPSS, just go to the Graphs menu and select Bar chart, choose Coin as the X axis and Result as the Y axis, and then right click on the chart to bring up the properties; this allows you to select error bars, and to specify that the error bars refer to the standard error rather than the confidence interval, which is the default.

3b1. If you have a newer version of SPSS, you can go to the Chart Builder, which will have a Gallery tab in the lower half of the window. Choose bar, and then Simple Error Bar (third item in the second row). Drag Coin to the X axis, Result to the Y axis, then click on Element Properties to select "Standard Error" as the interpretation of the error bar; OR

3b2. You can choose Legacy Dialogues from the Graphs menu and proceed as cyml describes above.

Good luck; let us know if that works for you. . . .
posted by muhonnin at 12:06 PM on March 18, 2013

cyml is correct. Specifically:

1. Make sure the data in your variables are 0/1, not 1/2 or "Heads"/"Tails" or whatever
2. Go Graphs > Legacy Dialogs > Bar
3. Select "Summaries of separate variables," hit Define
4. Add your two variables to the "Bars Represent" window by selecting them in the list and clicking the arrow. The default statistic should be Mean, just leave it
5. Click Options and tick "Display error bars," then select standard error (you might have to change the multiplier to 1, the default is 2)
6. That should be it. Enjoy the sickly greenish-yellow default graph coloring!
posted by theodolite at 12:09 PM on March 18, 2013

Behold, a visual guide!

This looks like an older version of SPSS, so the interface will look slightly different in the newer versions. In Ver.21, legacy dialogs can be accessed by clicking Graphs->Legacy Dialogs->Error Bar as cyml pointed out.
posted by Young Kullervo at 12:10 PM on March 18, 2013

OK, so I got it using muhonnin's 3b1. It's sort of baffling that I have to explicitly tell SPSS that a nominal variable is a scale variable in order to get it to do what I want.

How would I do this if I had only the four counts entered? Is there some way of doing this with "Weight cases"?
posted by Philosopher Dirtbike at 12:22 PM on March 18, 2013

« Older Question regarding children with depression   |   Need a new leather armrest cover... But from where... Newer »
This thread is closed to new comments.