Introduction to Probability and Statistics

What does stat0002 do?

The stat0002 package provides R code, datasets, articles (tutorials demonstrating how to use R code) and ‘movies’ (interactive plots) to help students taking STAT0002 Introduction to Probability and Statistics at University College London (UCL) to understand the course material and to see how R can be used to perform some of the analyses in the course.

Currently, it is not compulsory for you to use R when studying for STAT0002. However, it is strongly recommended that you use R and make use of the content of the stat0002 package. Being able to use a statistical computing package like R is essential for performing statistical analyses and many students taking STAT0002 will need to use R in other modules.

Software required

If you need to install R then you can get it from CRAN. Choose your computer’s operating system: Windows, macOS or Linux. Do not change the default installation settings.

For users of older Intel Macs: stat0002 uses the tcltk package, so may need to install XQuartz.

I recommend that you use RStudio (a free user-friendly front-end to R). Install it from the Download RStudio page. Find All Installers near the bottom of the page and choose the installer for your operating system.

Installation of stat0002

Copy and paste the following into the R console and press return.

install.packages(c("anscombiser", "distributions3", "plotrix", "rgl", "rpanel", "rust", "smovie", "SuppDists", "tkrplot", "vcd"))

Then copy and paste ONE of the following into the R Console and press return. Choose the option that is relevant to your computer.

Windows

install.packages("https://github.com/paulnorthrop/stat0002/raw/master/install/stat0002.zip", repos = NULL)

Apple MacOS

install.packages("https://github.com/paulnorthrop/stat0002/raw/master/install/stat0002.tgz", repos = NULL)

Linux

install.packages("https://github.com/paulnorthrop/stat0002/raw/master/install/stat0002.tar.gz", repos = NULL)

Getting started

Then type

library(stat0002)
?stat0002

to open the main help page, which contains links to articles with tutorials about R code, datasets and movies. The Index at the bottom links to help files for individual functions and datasets. If ?stat0002 doesn’t work then close RStudio, reopen it and try again.

However, perhaps the most convenient source of this information is the stat0002 home page on GitHub, which has help files under Reference and tutorials under Articles (direct link: Articles).

Suggestions about how to use this resource

  • Use the tutorials to see how some of the content of STAT0002 is produced. There are questions to consider in some of these tutorials.
  • Look at the example datasets when they arise during the module. Play with them in R.
  • Run the ‘movies’ shown in STAT0002 workshops and videos for yourself.
  • Look at the code in some of the R functions. For example, if you type scatter in the R console and press return then you will see the content of the function scatter. Use ?scatter to find out what the function does and look at the code to see how it does it.

You will find that some tutorials contain ideas that we have not yet covered in lectures and occasionally things that are beyond the scope of STAT0002. If you want to try to understand ideas before we cover them then please use the links to further information that have been provided.