This course is designed by Dr. Jesper Rydén, a Senior Lecturer in Biometrics at SLU, and lectured by Dr. Raazesh Sainudiin, a Researcher in Applied Mathematics and Statistics at the Department of Mathematics, Uppsala University and a Data Science Consultant at Combient AB in Stockholm.


See 1MS369: Generalised Linear Models for more details.


Models with different link functions. Binary (logistic) regression, Estimation and model fitting. Residual analysis. Mixed effext models. Hierarchical models. Practical examples. R commands.

Course Materials

Lecture Slides

The materials linked in this section are retrieved and reorganized from It was kindly made available by Henrik Madsen and Poul Thyregod, the authors of the required course Text-Book.

R Example Codes and data.

NOTE: You need to attend the lectures for content scribed on the board or codes done in class. If you miss a lecture or two you can catchup using slides and going through examples in the Text-Book for the course Madsen, Henrik; Thyregod, Poul, Introduction to general and generalized linear models, Boca Raton, Fla.: CRC, cop. 2011. See READING LIST in 1MS369: Generalised Linear Models to Find in the Library at Uppsala University.

Assigned Exercises

Please submit the exercises (as hard-copy) right after the exam to the instructor’s mailbox in the Math Department.

Sample Exam

Here is a sample exam and its solution.

This is a new course and there is only one sample exam appropriate for this instance. Doing exercises and reading the first 4 Chapters of the text-book is the best way to prepare for the exam.


Plain R

We can run R from command-line after installing it on your system. Test it and you should get something like the following if you have installed correctly.

$ R

R version 3.4.4 (2018-03-15) -- "Someone to Lean On"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> 1+1
[1] 2


(SageMath is non-examinable)

We might also use SageMath locally during face-to-face interactions. You may also collaborate in COCALC remotely. All needed programming basics will be introduced as needed.

Prepare your laptop on your own! but using free COCALC is quite easy for the price.

Follow the download and installation instructions for your Operating System from the following URL:

To test that you have installed correctly do the following:

  • On a Mac OS X or Unix/Linux syatem, say you installed sage in a directory inside your home directory called ~/all/software/sage/, then you can see if the following command launches a Jupyter notebook server successfully:

$ ~/all/software/sage/SageMath/sage -n jupyter

SageMath Notebook Server

Download the SageMath ipynb notebooks for running R codes as they become available as

Individual SageMath Jupyter .ipynb Notebooks for R and beyond!

After downloading it into the directory you launched the sage jupyter notebook server from. You should be able to see all the jupyter .ipynb notebooks by navigating from your jupyter notebook server.

Apache SparkR

(SparkR is non-examinable)

In your databricks community edition account import .dbc or .html file from:

Course on GitHub

The source GitHub directory for the course contents is: