494345930

Python & R vs. SPSS & SAS

When we’re working for clients we mostly come across the statistical programming languages SAS, SPSS, R and Python. Of these SAS and SPSS are probably the most used. However, the interest for the open source languages R and Python is increasing. In recent years, some of our clients migrated from using SAS or SPSS to using R and/or Python. And even if they haven’t (yet), most commercial software packages (including SAS and SPSS) make it possible to connect to R and Python nowadays.

SAS was developed at the North Carolina State University and was primarily developed to be able to analyse large quantities of agriculture data. The abbreviation SAS stands for Statistical Analysis System. In 1976 the company SAS was founded as the demand for such software increased. Statistical Package for the Social Sciences (SPSS) was developed for the social sciences and was the first statistical programming language for the PC. It was developed in 1968 at the Stanford University and eight years later the company SPSS Inc. was founded, which was bought by IBM in 2009.

In 2000 the University of Auckland released the first version of R, a programming language primarily focused on statistical modeling and was open sourced under the GNU license. Python is the only one that was not developed at a university. Python was created by a Dutch guy who is a big fan of Monty Python (where the name comes from). He needed a project during Christmas and created this language which is based on ABC. ABC is a language, also created by him, with the goal to teach non-programmers how to program. Python is a multi-purpose language, like C++ and Java, with the big difference and advantage that Python is way easier to learn. Programmers carried on and created lots of modules on top of Python and it therefore has a wide range of statistical modeling capabilities nowadays. That’s why Python definitely belongs in this list.

In this article, we compare the four languages on methods and techniques, ease of learning, visualisation, support and costs. We explicitly focus on the languages, the user interfaces SAS Enterprise Miner and SPSS Modeler are out of scope.

table

Statistical methods and Techniques

My vision on Data Analysis is that there is continuum between explanatory models on one side and predictive models on the other side. The decisions you make during the modeling process depend on your goal. Let’s take Customer Churn as an example, you can ask yourself why are customers leaving? Or you can ask yourself which customers are leaving? The first question has as its primary goal to explain churn, while the second question has as its primary goal to predict churn. These are two fundamentally different questions and this has implications for the decisions you take along the way. The predictive side of Data Analysis is closely related to terms like Data Mining and Machine Learning.

When we’re looking at SPSS and SAS, both of these languages originate from the explanatory side of Data Analysis. They are developed in an academic environment, where hypotheses testing plays a major role. This makes that they have significant less methods and techniques in comparison to R and Python. Nowadays, SAS and SPSS both have data mining tools (SAS Enterprise Miner and SPSS Modeler), however these are different tools and you’ll need extra licenses.

One of the major advantages of open source tooling is that the community continuously improves and increases functionality. R was created by academics, who wanted their algorithms to spread as easily as possible. Ergo R has the widest range of algorithms, which makes R strong on the explanatory side and on the predictive side of Data Analysis.

Python is developed with a strong focus on (business) applications, not from an academic or statistical standpoint. This makes Python very powerful when algorithms are directly used in applications. Hence, we see that the statistical capabilities are primarily focused on the predictive side. Python is mostly used in Data Mining or Machine Learning applications where a data analyst doesn’t need to intervene. Python is therefore also strong in analysing images and videos, for example we’ve used Python this summer to build our own autonomous driving RC car. Python is also the easiest language to use when using Big Data Frameworks like Spark.

Ease of learning

Both SPSS and SAS have a comprehensive user interface, with the consequence that a user doesn’t necessarily need to code. Furthermore, SPSS has a paste-function which creates syntaxes from steps executed in the user interface and SAS has Proc SQL, which makes SAS-coding a lot easier for people who know the SQL query language. SAS and SPSS code are syntaxtically far from similar to each other and also very different from other relevant programming languages, so when you need to learn one of these from scratch, good luck with it!

Although there are GUI alternatives for R, like Rattle, it doesn’t come close to SAS or SPSS in terms of its functionality. R is easily to learn for programmers, however, a lot of analysts don’t have a background in programming. R has the steepest learning curve from all, it’s the most difficult one to start with. But once you get the basics, it gets easier soon. For this specific reason, we’ve created a R course, called Experience R, which kickstarts (aspiring) data analysts / scientists in learning R. Python is based on ABC, which is developed with the sole purpose of teaching non-programmers how to program. Readability is one of the key features of Python. This makes Python the easiest language to learn. As Python is so broad, there are no GUI’s for Python.

To conclude, as for ease of learning SPSS and SAS are the best option for starting analysts as they provide tools where the user doesn’t need to program.

Support

Both SAS and SPSS are commercial products and therefore have official support. This motivates some companies to choose for these languages: if something goes wrong, they’ve got support.

There is a misconception around the support for open-source tooling. It’s true that there is no official support from the creators or owners, nonetheless, there’s a large community for both languages most willing to help you to solve your problem. And 99 out of 100 times (if not more often), your question has already been asked and answered on sites like Stack Overflow. On top of that, there are numerous companies that do provide professional support for R and Python. So, although there’s no official support for both R and Python, in practice we see that if you’ve got a question, you’ll likely have your answer sooner if it’s about R or Python than in case it’s SAS or SPSS related.

Visualisation

The graphical capabilities of SAS and SPSS are purely functional; although it is possible to make minor changes to graphs, to fully customize your plots and visualizations in SAS and SPSS can be very cumbersome or even impossible. R and Python offer much more opportunities to customize and optimize your graphs due to the wide range of modules that are available. The most widely used module for R is ggplot2, which has a wide set of graphs where you’re able to adjust practically everything. These graphs are also easily made interactive, which allows users to play with the data through applications like shiny.

Python and R learned (and still learn) a lot from each other. One of the best examples of this is that Python also has a ggplot-module , which has practically the same functionality and syntax as it does in R. Another widely used module for visualisation in Python is Matplotlib.

Costs

R and Python are open source, which makes them freely available for everybody. The downside is that, as we’ve discussed before, these are harder to learn languages compared to start using the SAS or SPSS GUI. As a result, analysts equipped with R and/or Python in their skillset have higher salaries than analyst that don’t. Educating employees that are currently not familiar with R and/or Python costs money as well. Therefore, in practice it isn’t the case that the open source programming language are completely free of costs, but when you compare it with the license fees for SAS or SPSS, the business case is very easily made: R and Python are way cheaper!

My choice

“Software is like sex, it’s better when it’s free” – Linus Torvalds (creator Linux)

My go-to tools are R and Python, I can use these languages everywhere without having to buy licenses. Also I don’t need to wait for the licenses. And time is a key feature in my job as a consultant. Aside from licenses, probably the main reason is the wide range of statistical methods; I can use any algorithm out there and choose the one that suits the challenge at hand best.

Which of the two languages I use depends on the goal, as mentioned above. Python is a multi-purpose language and is developed with a strong focus on applications. Python is therefore strong in Machine Learning applications; hence I use Python for example for Face or Object Recognition or Deep Learning applications. I use R for goals which have to do with customer behaviour, where the explanatory side also plays a major role; if I know which customers are about to churn, I would also like to know why.

These two languages are for a large part complementary. There are libraries for R that allow you to run Python code (reticulate, rPython), and there are Python modules which allow you to run R code (rpy2). This makes the combination of the two languages even stronger.


Jeroen Kromme, Senior Consultant Data Scientist

 

12 replies
  1. Boris N
    Boris N says:

    Great read – agree with almost everything. I must say, however, R has very robust SQL support: sqldf allows you to write SQL queries on data frames, RJDBC & RODBC packages allow you to connect and interact with databases easily. As for ease of learning, the tidyverse (dplyr, tidyr, ggplot2, magittr, etc…)make R a lot more approachable…

    Reply
  2. joao carlos
    joao carlos says:

    Hi Jeroen, great contribution, but I hope you could have time to post an extended version of this comparison to include some new venues that could alter some conclusions, particularly about availability of support for the enterprise and ease to publish the results for the “simple guy”, particularly with respect to R. For instance, Microsoft R, it’s a reality, they have a community and an enterprise version, accept all major CRAN packages, so with it, it’s supposed to go from the totally open and non-supported R environment to an enterprise mode of operation paying and getting support. Oracle has too, solutions to embed R code. Microsoft has shown how their version, even the community is faster and can manage big data sets (http://htmlpreview.github.io/?https://github.com/lixzhang/R-MRO-MRS/blob/master/Introduction_to_MRO_and_MRS.html).
    Another aspect quite often not taken into consideration in comparisons is the existence of “Shiny” from RStudio. Shiny empowers the solo data analyst and small teams to have interactive apps on a scale not available to other rival solutions, at least to my best knowledge at the time I write this comment.
    In time, in enjoy Python too. Best Regards.

    Reply
    • Jeroen Kromme
      Jeroen Kromme says:

      Hi Joao, thanks! You’re right about Microsoft R Open, I use it too because it’s faster. Reason I didn’t talk about it in this post is because it went to indepth, I’m also not talking about which types of licenses there are for SPSS. Shiny is definitely a strength, taking about this in the vizualistion part. The ease of sharing insights and let users play around with data is an unprecedented advantage of R!

      Reply
  3. burt
    burt says:

    Very informative article. Thank you. I think the most important point in choosing a data platform is how you think. If you can’t or don’t want to code, go with the commercial offerings. If you can, then it boils down to whether you think functionally or procedurally.
    One thing: it’s Stanford University, not the University of Stanford. It was named for an early benefactor, like Harvard and Yale. I mention this because in America there is actually a difference between many “university of…” and “…university”. Has to do with legal status and quality.

    Reply
    • Jeroen Kromme
      Jeroen Kromme says:

      Hi Burt, agree with going for commercial platforms if you ‘don’t want to code’, ‘can’t code’ is a different story. Ah thanks, didn’t know that! Changed it!

      Reply
  4. Jon Peck
    Jon Peck says:

    I would like to point out that the extension command mechanism for SPSS Statistics, which includes the ability to easily build a dialog box for a procedure, makes it easy to add R or Python or Java code as a regular command. And over 100 such extensions, including many especially for data mining, come either installed with Statistics or can be added from within the program.

    Reply
  5. Humberto Macias
    Humberto Macias says:

    Thankyou for your article. I do data analista and economic predictionsb for small enterpise from the 90’s but always in Excel, making evertrhing by miself. As a solo analyst. I knew about SPSS but as an old engineer I do like coding my own. With your article, I hace e Lot better perspectiva, thankyou. Maybe is time to pívot in the R AND Phyton way. THANKYOU again. :-)

    Reply

Trackbacks & Pingbacks

  1. […] Source: The Analytics Lab […]

  2. […] Python & R vs. SPSS & SAS — The Analytics Lab  – 2017 — This is nice because it also puts into perspective how SPSS and SAS play into the landscape as well as provides additional historic perspectives […]

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *