How to access the course material in Github

Instead of trying to download each file separately via the Github interface, it is recommended to use one of these options:

  • The best way is to clone the repository using git, and use pull to get the latest updates.
    • If you want to learn to use git, start by installing a git client. There are plenty of good git tutorials online.
  • If you don’t want to learn to use git, download a the repository as a zip file. Click the green button “Code” at the main page of the repository and choose “Download ZIP” (direct link). Remember to download again during the course to get the latest updates.

Problems installing R packages on Windows ?

Getting the setup needed for the course working on Windows might involve a bit more effort than on Linux and Mac. Consequently, we recommmend using either Linux or MacOS, or using R remotely. Moreover, Stan, the probabilistic programming language which we will use later on during the course requires a C++ compiler toolchain which is not available by default in Windows (blame Microsoft). However, if you want to use Windows and have a problem getting the setup working, below are two options to consider:

How to use R and RStudio remotely

Option 1: Using R and RStudio via Jupyterhub

Instead of installing RStudio on your computer, you can use it in your web browser:

  • Information about Aalto JupyterHub
  • Go to jupyter.cs.aalto.fi
  • Choose R: General use (JupyterLab)
  • In the Launcher click RStudio
  • In the RStudio Files pane (bottom right) you can create folders for your work and upload files from your computer to the server
    • The notebooks folder is the only persistent folder (stays there if you sign out) so save everything to that folder!
    • You may get an error when uploading a large zip file, but uploading smaller zip files work. If you can’t upload demo zip file contact the course staff via Zulip.
    • You may access your data as a network drive by SMB mounting it on your own computer - see Accessing JupyterHub data. This allows you to have total control over your data.
  • After uploading files, use Files pane to open them (e.g. an RMarkdown notebook)
  • Knitting of R and Rmd files works as well (tested 10th September)
  • CmdStanR used later in the course has been tested to work 10th September.
  • There is a limited memory available (3Gib) and bigger models and datasets can run out of memory with cryptic error message, but the demos and assignment models should run (if not, then contact the course staff via Zulip).
  • See also Aalto JupyterHub FAQ and bugs

Option 2: Use Aalto Linux via remote-desktop solution provided by Aalto-IT.

  • Information about Aalto remote desktop
  • Goto vdi.aalto.fi
  • Download VMWare Horizon application or use the web portal
    • If using the VMWare Horizon application, click on New Server and enter vdi.aalto.fi
  • Enter your aalto username (aalto email works too) and password in the respective fields.
  • Select Ubuntu 20.04
  • Click Activities, start typing RStudio in the search bar, and clik RStudio.

Installing aaltobda package

The course has its own R package aaltobda with data and functionality to sim- plify coding. To install the package just run the following (upgrade=”never” skips question about updating other packages):

  1. install.packages("remotes")
  2. remotes::install_github("avehtari/BDA_course_Aalto", subdir = "rpackage", upgrade="never")

If during the course there is announcement that aaltobda has been updated (e.g. some error has been fixed), you can get the latest version by repeating the second step above.

Installing knitr

If you just installed RStudio and R, chances are you don’t have knitr installed, the package responsible for rendering your notebook to pdf.

Solution:

install.packages("knitr")

You can also install packages from RStudio menu Tools->Install Packages.

If knitr is installed but the pdf won’t compile

In this case it is possible that you don’t have LaTeX installed, which is the package that runs the engine to process the text and render the pdf itself.

Solution: Tinytex is the bare minimum Latex core that you need to install in order to run the pdf compiler. If you want to go further and download a full distribution of Latex, look at TeX Live for Linux and MacTeX for Mac OS.

install.packages("tinytex")
tinytex::install_tinytex()

How to install the latest version of RStan or CmdStanR

  • Make sure you have installed R version 3.4.0 or newer. If you don’t, install a newer version using instructions from https://www.r-project.org/
  • Install RStan along with the necessary C++ compiler toolchain as described here

Instead of RStan, you can also use new CmdStanRwhich maybe easier to install. * CmdStanR is a lightweight interface to Stan for R users (see CmdStanPy for Python). * CmdStanR avoids some installation problems as it doesn’t require matching C++ tools for R and RStan

What is tidyr or tidyverse that is used in the R demos? What does %>% mean?

  • Tidyverse is a collection of R packages designed for data science. The packages “share an underlying design philosophy, grammar, and data structures”.
  • A clear characteristic that distinguishes tidyverse from the base R is the pipe operator %>%
  • In this course you do not need to use tidyverse. However, some packages belonging to tidyverse, such as ggplot2, can be useful for visualizing results in the reports.

How to access the BDA R (and Python) demos on CS JupyterHub

  • Goto jupyter.cs.aalto.fi on your favourite web-browser.

  • Log-in with your aalto username and password.

  • Select the R: General use (JupyterLab) server.

  • Select the notebooks folder in the left hand file browser.

  • Select the git clone icon as seen in the screenshot below.

  • In the text box type https://github.com/avehtari/BDA_R_demos.git for python demos replace BDA_R_demos.git with BDA_Python_demos.git instead. Then click clone.

  • Wait a while, there should be BDA_R_demos folder under notebooks folder. Click on the BDA_R_demos folder.

  • Click on the RStudio button on the right.

  • Now you should have an R-studio like interface in your web-browser. Click on File -> Open File...

  • Click on notebooks and then select BDA_R_demos folder.

  • Select a demo to run. Here we open the folder demos_ch2 and then select demo2_1.R file and click open. This should open the file in the window.

  • Select the contents of the file and click Code -> Run Selected Line(s) as shown in the screenshot below.

  • You should see the output of the code in the bottom right corner.

I missed some deadline or wasn’t able to do some part of the course

  • I missed the deadline to register for the course in Sisu. Can I join the course?
    • Yes, just register in MyCourses.
  • I missed the deadline for the assignment. Can you accept my late submission?
    • If you miss the deadline during the few first rounds due technical problems, but you send the pdf to one of the TAs few minutes after the deadline it can accepted once. As the recommnded submission time is before 4pm on Friday, you have in general 56 hours extra hours for submission and several few minute late submissions is not likely just due to the technical problems.
  • I was not able to do one of the assignments because [some personal problem]. Can I do some extra work?
    • Things happen and you don’t need to tell the course staff your personal reasons (especially you shouldn’t tell any health issue details). Everyone gets a second change in period III. In period III there is just one submission deadline, but otherwise the procedure is the same (ie you need to return all the assignments). If you submitted the project work in autumn you don’t need to re-submit it if you re-submit assignments.
  • I missed the deadline to register project group. Can I still register?
    • Yes. Those who registered early are allowed to choose the presentation slots first.
  • My group member a) disappered, b) doesn’t do anything, c) is annoying. Can I continue with the project alone.
    • First we hope you can resolve the issue, but if nothing works, then you can continue the project work alone.
  • I was not able a) to do the project or b) to give a presentation because [some personal problem]. Can a) I submit it later, b) present later.
    • Things happen and you don’t need to tell the course staff your personal reasons (especially you shouldn’t tell any health issue details). Everyone gets a second change in period III. In period III there is second project submission deadline and presentation slots. If you are happy with your assignment score, you don’t need to re-submit assignments if you submit the project work in period III.