Due to the Corona virus education methods or examination can deviate. For the latest news please check the course page in Brightspace.


nl en

Statistical computing with R


Admission requirements

Make sure you have a laptop available during each lecture with the latest version of R and RStudio (for details see Blackboard)

  1. Either you are at least first-year student in the Statistical Science program, or the Computer Science: Data Science specialization and you follow the courses Statistics & Probabiltiy (course nr.) and Generalized Linear Models and Linear Algebra (course nr.),


  1. You are familiar with elementary calculus and statistics, e.g. integration, derivation, law of large numbers, central limit theorem, probability distributions, z and t-tests, chi-square tests, analysis of variance, linear and logistic regression.


In this course we familiarize students with programming and statistical computation in the R(md) environment. Topics that will be covered include amongst others: datahandling, fitting statistical models, performing statistical tests, producing graphics, reproducible reports, the basics of programming in R and programming basic statistical algorithms.

Course objectives


At the end of the course the student can perform basic operations in R, and recognize several basic statistical problems as statistical computational problems and solve them using R, and use R markdown to communicate results.

Specific objectives:

  • master the basics of R in RStudio;

  • produce reproducible reports using R markdown;

  • perform and implement basic statistical procedures such as tests and analyses;

  • processing raw data into formatted data;

  • visualize data and (intermediate) results;

  • implement resampling methods to evaluate or create statistical tests and algorithms;

Mode of Instruction

A combination of self-study, lectures, lab and live-coding sessions.

Assessment method

The course consists of two examinations. One examination consists of two home assignments (1/3 of your final grade), the other examination consists of two written tests (2/3 of your final grade).

A = average grade of two home assignments
E_1 = grade for first written test 1 (programming exercises for which you should have your own laptop)
E_2 = grade for second written test 2 (programming exercises for which you should have your own laptop)

Your final grade, denoted with G, will be composed as follows

G = A * (1/3) + max( E_1 * 0.5 + E_2 * 0.5 , E_2) * (2/3)

When you have actively participated in the home assignments and the written exams, then there is the possible to attend in two types of resits: 1) one home assignment resit for both home assignments, and 2) one written resit exam for both written tests.


A_r = the grade for the resit of both home assignments.
E_r = the grade for the written resit exam of both written tests.

and let G_r denote the final grade that takes into account the resits, then

G_r = max(A, A_r) * (1/3) + max( E1 * 0.5 + E2 * 0.5, E2, E_r) * (2/3).

The grades max(A, A_r) and max( E1 * 0.5 + E2 * 0.5, E2, E_r) should be at least a 5.5, and the final grade should be at least a 6 to obtain course credits.

NB. The examinations consist of programming exercises for which your own laptop should be used.

Time and Exam Table

For the course days, course location and class hours check the Time Table 2017-2018 under the tab “Masters Programme” at http://www.math.leidenuniv.nl/statisticalscience or blackboard.

Non-compulsory reading list

A capita selecta (to be announced on blackboard) from the books:

The art of R programming. Norman Matloff, No Starch Press 2011, ISBN: 978-1-59327-384-2

Resampling Methods: A Practical Guide to Data Analysis Phillip I. Good, Birkhauser Boston 2006, 3rd edition, ISBN: 978-0-8176-4386-7

Permutation, Parametric and Bootstrap Tests of Hypotheses Phillip I. Good, Springer Series in Statistics 2005, ISBN: 978-0-387-27158-3.

The Elements of Statistical Learning Trevor Hastie, Robert Tibshirani, and Jerome Friedman, Springer Series in Statistics 2009

Course Registration

Enroll in Blackboard for the course materials and course updates.

To be able to obtain a grade and the ECTS for the course, sign up for the (re-)exam in uSis ten calendar days before the actual (re-)exam will take place. Note, the student is expected to participate actively in all activities of the program and therefore participates in and registers for the first exam opportunity.

Exchange and Study Abroad students, please see the Prospective students website for information on how to apply.

Contact information

rteam [at] statscience [dot] nl


  • This is a compulsory course in the Master’s programme Statistical Science for the Life & Behavioural sciences.

  • This course is a prerequisite for the course Advance Statistical Computing [4373ADSTCY].