Home > Uncategorized > Translating SPSS to R: Introduction

Translating SPSS to R: Introduction

I have been teaching the first semester of the graduate Psychology statistics course at Rice University since 1999. During that time, I have primarily used SPSS (though early on I also used SAS). I learned both SAS and SPSS in graduate school. I have long had a love/hate relationship with SPSS. It does some things so well and so easily, and other things are so bizarre and awful it’s mind-boggling. I’ve been ready to try something else but SPSS is the king of the hill in my field and has been for a while.

The world is changing, though, and psychologists are increasingly moving to R. So, this year I decided I would learn R and provide all my example code, homework solutions, and exam solutions in both SPSS and R. This has been (and continues to be, as the semester isn’t over yet) more difficult than I initially thought. I am also admittedly a novice when it comes to R, so many of my solutions may be inelegant. Despite that, I thought it might be useful to document all this publicly as a resource for anyone else making a similar transition. There are some resources out there for people making the switch, but most of those seem to be focused on basic syntax and data management, not on the nitty-gritty of doing Psych statistics. That’s where I’m headed.

So, for the next couple months, I’ll be posting annotated snippets of SPSS code accompanied by approximately equivalent R code for doing statistics on Psych-oriented data. When it’s especially relevant, I’ll post the associated output, and perhaps comment on that as well. I will also post some random thoughts on my impressions of R and the R community. For instance, the R community likes to claim the reason R can be hard to learn is that it’s so flexible. That’s sometimes true, but sometimes R is hard to learn because of simple bad design and needless inconsistency. There are also things to really like about R, too, and I will touch on some of those so this won’t be entirely one-sided.

So, if you’re familiar with SPSS and are transitioning to R, or are thinking about doing so, or know someone in that boat, stay tuned—hopefully this series will have something of use to you.

Postscript on Context
My statistics course is focused on fundamental concepts in statistical inference and comparisons of means, particularly ANOVA. This includes repeated measures and contrast analysis. While tools like JMP might be great for exploratory data analysis, they don’t handle 5-way within-subjects ANOVAs very well; I need tools that can. The other issue that’s relevant is the students. They are bright and motivated (mostly), but being a psychology program, a sizable minority of the students are math phobic, illiterate with respect to programming, or both. Getting some of them to use SPSS syntax (rather than the GUI) can be a challenge, so R looks pretty daunting to some of them. It’s a barrier.

As for me, I have previously used BMDP, SAS, JMP, and Minitab (oh, and a very little bit of Systat), so I’m familiar with multiple data analysis packages. In addition, besides my Ph.D. in Psychology I have a Master’s in Computer Science and I’ve written substantial programs in Basic, Fortran, Pascal, C/C++, Java, Lisp, Python, and enough scripting languages that I’ve forgotten many of them (sh, HyperTalk, and AppleScript come to mind but there have been many others). I’ve written small programs in assembler, Ada, Prolog, Scheme, ML, Smalltalk, Snobol (don’t ask), make, Matlab, and probably a few others. I mention this not to try to show off, but to point out that if I am having difficulty with some piece of R, it’s certainly not because I don’t understand stats packages or programming languages.

Categories: Uncategorized Tags: , ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: