{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Practicum 3 - May 7, 2025" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "- Due Date: Friday, May 7th no later than 11:50 a.m.\n", "- Submission Instructions: Upload your solution, entitled **YourFirstName-YourLastName-Practicum3.ipynb** to the \n", "BrightSpace Practicum 3 Dropbox.\n", "- Note: For all questions, determine the answer using python constructs (as opposed to eyeballing the csv file)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Starting Code" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from datascience import *\n", "%matplotlib inline\n", "import numpy as np\n", "import matplotlib.pyplot as plots" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Data File" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Download **tb.csv** and place it in the same directory as your Jupyter notebook." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Place the csv file in the same directory as this notebook\n", "tb = Table().read_table(\"tb.csv\")\n", "tb.show(3)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Question 1 - 10 points" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Update the *tb* table so that it only contains data entries for 2013. Print out\n", "the number of data entries that the updated table contains. Use the updated table\n", "for all of the remaining questions." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Place answer here." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Question 2 - 10 points" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Calculate and print the country name and population of (1) the country with the smallest population\n", "and (2) the country with the largest population. One line of the output might look something like this:\n", "*Afghanistan has the smallest population of 30551674*" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Place answer here." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Question 3 - 10 points ##" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Add the following two columns to the *tb* table: *Population SU* and *TB Cases SU*. These\n", "columns should contain the standard units of the data in the *Population* and *TB Cases*\n", "columns respectively. Display the first three rows of the updated *tb* table." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Place answer here." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Question 4 - 10 points ##" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Display a scatter plot that shows *Populations SU* on the x-axis\n", "and *TB Cases SU* on the y-axis." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Place answer here." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Question 5 - 10 points ##" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Part A. Calculate and print the correlation coefficient between the *Population SU* and the *TB Cases SU*." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Place answer here." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Part B. Explain what the value of the correlation coefficient indicates regarding the\n", "relationship between the *Population SU* and the *TB Cases SU*." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Explanation**: " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Question 6 - 10 points" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Calculate and display the values of **m** and **b** for the regression line **y = mx + b**\n", "when we are trying to predict the value of *TB Cases SU* from\n", "*Population SU*." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Place answer here." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Question 7 - 15 points" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Part A. Use the values of **m** and **b** that you calculated in Question 6\n", "to estimate and print *TB Cases SU* for a country that has a population of 30 million." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Place answer here." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Part B. Translate the *TB Cases SU* that you calculated in Part A into an\n", "estimate for *TB Cases*." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Place answer here." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Question 8 - 10 points" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Use the bootstrap method of 16.2.3 to estimate the 85% confidence interval of the true slope of y = mx + b\n", "where x is the *Population* and y is the *TB Cases* using 1000 repetitions. Display the same type of text and\n", "histogram output that appears in section 16.2.3 immediately following this sentence:\n", "\n", "*bootstrap_slope(baby, 'Maternal Height', 'Birth Weight', 5000)*" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Place answer here." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Question 9 - 15 points " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Part A. Explain why the slope of the regression line in Question 8 is different than\n", "the slope of the regression line in Question 6." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Explanation**:" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Part B. As the number of repetitions is increased towards infinity, will the histogram produced \n", "in Question 8 show a normal distribution? Explain." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Answer and Explanation**:" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Part C. Based on the histogram produced in Question 8, should you accept or reject the **Null Hypothesis** that\n", "the slope of the true line is 0.003? Explain." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Answer and Explanation**:" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.5" } }, "nbformat": 4, "nbformat_minor": 4 }