{ "cells": [ { "cell_type": "markdown", "id": "ef0a89e0", "metadata": {}, "source": [ "# Tutorial Exercises\n", "\n", "## Heart attack data\n", "\n", "In this example we will use data from 12,843 patients admitted to hospital in New York City with a heart attack.\n", "The data were collected via the Medicare system and are modified from a dataset at DASL\n", "\n", "These exercises will review some of the skills learned over the last three weeks. They will also prepare you for the first hand-in exercise: to produce a report for the Chair or Medicare, describing the main factors affecting cost and length of hospital stay for heart attack patients." ] }, { "cell_type": "markdown", "id": "554bd33b", "metadata": {}, "source": [ "### Set up Python libraries\n", "\n", "As usual, run the code cell below to import the relevant Python libraries" ] }, { "cell_type": "code", "execution_count": null, "id": "6e215164", "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\n", "sns.set_theme()" ] }, { "cell_type": "markdown", "id": "77e481a2", "metadata": {}, "source": [ "### Load and inspect the data" ] }, { "cell_type": "code", "execution_count": null, "id": "181072c8", "metadata": {}, "outputs": [], "source": [ "heartAttack=pandas.read_csv('https://raw.githubusercontent.com/jillxoreilly/StatsCourseBook/main/data/heartAttack.csv')\n", "display(heartAttack)" ] }, { "cell_type": "markdown", "id": "c7d3a5e9", "metadata": {}, "source": [ "What data do we have for each patient?\n", "