{ "cells": [ { "cell_type": "markdown", "id": "1a535332", "metadata": {}, "source": [ "# Homework 10 - Chapter 15" ] }, { "cell_type": "markdown", "id": "e680f7b3", "metadata": {}, "source": [ "- Due Date: Friday, April 17th no later than 11:59 p.m.\n", "- Partner Information: You may complete this assignment individually or with exactly one classmate.\n", "- Submission Instructions (working alone): Upload your solution, entitled **YourFirstName-YourLastName-Homework10.ipynb** to the \n", "Canvas Homework 10 Dropbox.\n", "- Submission Instructions (working with one classmate): Upload your solution, entitled \n", "**YourFirstName-YourLastName-PartnerFirstName-PartnerLastName-Homework10.ipynb** to the Canvas Homework 10 Dropbox. Note: If you \n", "work with a partner, only one person needs to submit a solution. If you both submit a solution, the submission that will be graded is the one \n", "from the partner whose last name comes alphabetically first.\n", "- Deadline Reminder: Once the submission deadline passes, Canvas will no longer accept your submission and you will no longer be able to earn credit. \n", "Thus, if you are not able to fully complete the assignment, submit whatever you have before the deadline so that partial credit can be earned." ] }, { "cell_type": "markdown", "id": "272c505f", "metadata": {}, "source": [ "## Starting Code" ] }, { "cell_type": "code", "execution_count": 1, "id": "8eee4bf0", "metadata": {}, "outputs": [], "source": [ "from datascience import *\n", "import numpy as np\n", "%matplotlib inline" ] }, { "cell_type": "markdown", "id": "04057e0f", "metadata": {}, "source": [ "Download the file [golf.csv]()\n", "into the same directory as this Jupyter notebook." ] }, { "cell_type": "code", "execution_count": null, "id": "d0976652", "metadata": {}, "outputs": [], "source": [ "# Place the csv file in the same directory as your solution\n", "golf = Table().read_table(\"golf.csv\")\n", "golf.show(3)" ] }, { "cell_type": "markdown", "id": "1f2c221e", "metadata": {}, "source": [ "## Question 1a - 1 Points" ] }, { "cell_type": "markdown", "id": "34345532", "metadata": {}, "source": [ "The Master's is a storied May golf tournament that has been played since 1934. Many legendary golfers have won it and been rewarded with a Green Jacket, the latest being Rory McIlroy. Being the first \"Major\" tournament of the PGA season, it signifies the start of the golf season to many. Unlike in Augusta Georgia, where the Master's takes place, golfers in Montana can only play during the warm-weather months. This causes many people to travel to warmer climates to hit the course any time of the year. You have been hired by a golf course in one of these warmer climates, and the course management wants to know how environmental factors influence how busy their greens get.\n", "\n", "You’ve been asked to explore how **Temperature** affects the **Crowdedness** of the course. First, convert the **Temperature** and **Crowdedness** columns into standard units, and add these as new columns called **Standardized Temperature** and **Standardized Crowdedness**, respectively. Then, display a scatterplot of **Standardized Temperature** and **Standardized Crowdedness**." ] }, { "cell_type": "code", "execution_count": 3, "id": "ffb61eb8", "metadata": {}, "outputs": [], "source": [ "# Place answer here." ] }, { "cell_type": "markdown", "id": "4727cdab", "metadata": {}, "source": [ "## Question 1b - 1 Point" ] }, { "cell_type": "markdown", "id": "9e06068c", "metadata": {}, "source": [ "The course management wants to see how associated these two values are mathematically. Calculate *r* (the correlation coefficient) of the columns **Standardized Temperature** and **Standardized Crowdedness**, and print it in the following format where d is a digit: *The correlation between Standardized Temperature and Standardized Crowdedness is: 0.dd*" ] }, { "cell_type": "code", "execution_count": 4, "id": "c6b4c24c", "metadata": {}, "outputs": [], "source": [ "# Place answer here." ] }, { "cell_type": "markdown", "id": "42ed4388", "metadata": {}, "source": [ "## Question 1c - 1 Point" ] }, { "cell_type": "markdown", "id": "40000a34", "metadata": {}, "source": [ "Do you believe that the correlation coefficient accurately shows the relationship between the two variables? Explain why or why not, using information from the textbook to support your answer." ] }, { "cell_type": "markdown", "id": "2dcaa586", "metadata": {}, "source": [ "**Your Answer Here -**" ] }, { "cell_type": "markdown", "id": "9320b16c", "metadata": {}, "source": [ "## Question 2a - 2 Points" ] }, { "cell_type": "markdown", "id": "b0b6f850", "metadata": {}, "source": [ "After seeing the correlation coefficient you calculated, the course management is ready to move on. However, using your worth-its-weight-in-gold data science knowledge, you know that crowdedness and temperature are associated. To begin to convince the management, you have decided to show them some visual diagnostics.\n", "\n", "Create a column for the residuals of the linear equation that best predicts the **Standardized Crowdedness** from the **Standardized Temperature**, using the correlation coefficient function that you wrote previously. Add these values to the table in a new column called **Residuals**, and create a scatterplot that shows the relationship between **Standardized Temperature** and **Residuals**." ] }, { "cell_type": "code", "execution_count": 5, "id": "074ff00b", "metadata": {}, "outputs": [], "source": [ "# Place answer here." ] }, { "cell_type": "markdown", "id": "cc80a372", "metadata": {}, "source": [ "## Question 2b - 1 Point" ] }, { "cell_type": "markdown", "id": "733d3a1a", "metadata": {}, "source": [ "Why does the scatterplot of **Standardized Temperature** and **Residuals** look similar to the scatterplot of **Standardized Temperature** and **Standardized Crowdedness**?" ] }, { "cell_type": "markdown", "id": "9268b2b0", "metadata": {}, "source": [ "**Your Answer Here -**" ] }, { "cell_type": "markdown", "id": "61b2042a", "metadata": {}, "source": [ "## Question 3 - 2 Points" ] }, { "cell_type": "markdown", "id": "837f7805", "metadata": {}, "source": [ "After viewing the residuals plot and using your data science knowledge, you suspect that this relationship will likely be more accurately modelled using a quadratic equation. \n", "\n", "Calculate the best fitting quadratic equation that predicts **Standardized Crowdedness** from **Standardized Temperature**. (Hint: Consider using the *minimize* function!). Create an overlaid scatterplot, showing the original data and this curve." ] }, { "cell_type": "code", "execution_count": null, "id": "c2016c72", "metadata": {}, "outputs": [], "source": [ "# Place answer here." ] }, { "cell_type": "markdown", "id": "57d4a337", "metadata": {}, "source": [ "## Question 4 - 2 Points" ] }, { "cell_type": "markdown", "id": "159cc80d", "metadata": {}, "source": [ "Develop an insightful visualization that uses the provided csv file, Chapter 15 knowledge, and any other data science knowledge that you have previously learned. Explain your visualization and what makes it insightful." ] }, { "cell_type": "code", "execution_count": null, "id": "4e3f0400", "metadata": {}, "outputs": [], "source": [ "# Place answer here." ] } ], "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.14.2" } }, "nbformat": 4, "nbformat_minor": 5 }