mala::home Davide “+mala” Eynard’s website


Statistical learning with R part 1 (2016): Linear regression

[This post is part of the Statistical learning with R - 2016 edition series. You might want to check out the 2015 edition too]

So, if you are here you probably have already unpacked the zip file. If not, please check this page before starting.

Try to run LinearRegressionDemo.R: supposing your current working directory is the one where you unpacked the R files, type


The print.eval parameter is needed to show you the output of some commands such as summary in the context of the source command.

Run the demo and try answering the questions you find there. In some cases you should be able to do that immediately after looking at the results, in others you will first need to add few lines of code to actually get any result. If you find yourself stuck anywhere, all the material you should need is either in the script itself or in the lab notes.


Statistical learning with R – 2016 edition

New year, new PAMI class, and a whole bunch of new R demos. If you have not played with R yet, the notes I have attached to the introductory Lab might be of help.

If you attended the class, you probably know what to do with the next posts. After you have ran each demo, answer the related questions you might find both in the blog post and in the demo itself. Add whatever is necessary (screenshots, code, text, links) to motivate your answers and convince me you actually ran the demos and understood their contents. Finally send me everything in a pdf file.

To run each demo, just open the R file you will find in each post with the source command in R, for example:

source("/whatever/your/path/is/demofilename.R",print.eval = TRUE)

For your convenience, here is a package containing all of the source and data files you need for your homework (the package will be updated every time a new demo is added). Remember that while you will not be asked to add much new code to the demos, you should at least be able to understand what it does and modify some parameters to produce different results. Now feel free to play with the following demos: