{ "cells": [ { "cell_type": "markdown", "id": "f038cfcb", "metadata": {}, "source": [ "# Tutorial exercises\n", "\n", "We again use the wellbeing dataset, to practice running permutation tests.\n", "\n", "### Set up Python libraries\n", "\n", "As usual, run the code cell below to import the relevant Python libraries" ] }, { "cell_type": "code", "execution_count": 1, "id": "e89735f8", "metadata": {}, "outputs": [], "source": [ "# Set-up Python libraries - you need to run this but you don't need to change it\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", "import scipy.stats as stats\n", "import pandas \n", "import seaborn as sns" ] }, { "cell_type": "markdown", "id": "661b65c2", "metadata": {}, "source": [ "## Colab users\n", "\n", "You need to use a more recent version of scipy.stats than the default. To do this run the following code block and *after* it has run, go to the menus at the top of colab and click `runtime-->Restart Runtime`" ] }, { "cell_type": "code", "execution_count": null, "id": "2fec5a73", "metadata": {}, "outputs": [], "source": [ "# Set-up Python libraries - you need to run this but you don't need to change it\n", "!pip install scipy==1.10.0\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", "import scipy.stats as stats\n", "import pandas \n", "import seaborn as sns" ] }, { "cell_type": "markdown", "id": "81aad7c0", "metadata": {}, "source": [ "### Import and view the data" ] }, { "cell_type": "code", "execution_count": 3, "id": "741e30af", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | ID_code | \n", "College | \n", "Subject | \n", "Score_preVac | \n", "Score_postVac | \n", "
---|---|---|---|---|---|
0 | \n", "247610 | \n", "Lonsdale | \n", "PPE | \n", "60 | \n", "35 | \n", "
1 | \n", "448590 | \n", "Lonsdale | \n", "PPE | \n", "43 | \n", "44 | \n", "
2 | \n", "491100 | \n", "Lonsdale | \n", "engineering | \n", "79 | \n", "69 | \n", "
3 | \n", "316150 | \n", "Lonsdale | \n", "PPE | \n", "55 | \n", "61 | \n", "
4 | \n", "251870 | \n", "Lonsdale | \n", "engineering | \n", "62 | \n", "65 | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
296 | \n", "440570 | \n", "Beaufort | \n", "history | \n", "75 | \n", "70 | \n", "
297 | \n", "826030 | \n", "Beaufort | \n", "maths | \n", "52 | \n", "49 | \n", "
298 | \n", "856260 | \n", "Beaufort | \n", "Biology | \n", "83 | \n", "84 | \n", "
299 | \n", "947060 | \n", "Beaufort | \n", "engineering | \n", "62 | \n", "65 | \n", "
300 | \n", "165780 | \n", "Beaufort | \n", "PPE | \n", "48 | \n", "56 | \n", "
301 rows × 5 columns
\n", "