Statistical Computing and Programming

Author

Vik Gopal, Daisy Pham Thi Kim Cuc

Published

December 23, 2025

Preface

One more robot learns to feel,

Something more than a machine..

The lyrics above are from the song “One More Robot/Sympathy 3000-21”, written by The Flaming Lips in 2002. When I started preparing to teach this course in mid-2023, AI had been around for a year or two already. I was stuck for a long time wondering if this course is still relevant; I played the song quite a few times..

Here’s what I mean: The course is meant to introduce statistics majors (and minors) to three computing languages: R, Python and SAS. But.. why does anyone need to know this when we can just ask Gemini? You can read more about this course on NUSmods.

If you are taking this course, should you pretend that AI does not exist? Obviously not! If you really need help, don’t hesitate to use AI. But if you do use AI, I would hope that you take some time to dissect it’s solution to aid in more long-term understanding and recall.

I believe there is a need for data analysts to know how to code from scratch, if only because of the value of the process. By coding from nought, and by digging into data ourselves, we sharpen our minds.

This textbook is used in a 13-week semester at the National University of Singapore NUS. As mentioned, the course introduces R, Python and SAS to statistics majors. If you are an instructor and are planning to use it, but only plan to use one of the languages (R or Python only), the flow of material will still work - just leave out chapters 1 or 2, and chapter 6. Chapters 3 to 10 contain R and Python code, while chapters 6 to 9 contain SAS code as well. In general, later chapters build on results and findings from earlier chapters.

If you are a student taking the course, try to go through the material in the book on your own. Lectures will contain more in-depth explanations of concepts and code. As part of your revision, try to give yourself small problems, that build on the examples in the book. Challenging yourself in this way will improve you as a data analysts.

It’s ok if you cannot solve every problem that you have set for yourself. There is great value in simply struggling with a problem. As part of that journey, you will learn some skills that will be useful in other problems. I sincerely hope you find joy in working with data, R, Python and SAS during this course!

If you find something useful in this textbook, please do let me know at vik.gopal@nus.edu.sg. The book, along with slides and scripts/notebooks can all be found in the github repository. If you need more details about anything, do feel free to write as well. Please cite this book as:

Gopal, V. and Pham, T.K.C. (2025) Statistical Computing and Programming. Zenodo. doi:10.5281/zenodo.17969651.

So long, and thanks for reading!

Vik

© 2025 Vik Gopal, Daisy Pham Thi Kim Cuc. This book is licensed under Creative Commons Attribution 4.0 International (CC BY-SA 4.0). You are free to share and adapt with attribution. Code snippets are licensed under the MIT License. See the repository’s LICENSE and LICENSE-CODE.