\n",
" **Question 1**

\n", " Please load the data set located at**https://cims.nyu.edu/~brenden/courses/labincp/data/parenthood.csv** into a dataframe called **ph_df** and inspect the column headers, etc..\n",
"

"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n", " Please load the data set located at

\n",
" **Your Answer**

\n", " Delete this text and put your answer here. The code for your analysis should appear in the cells below.\n", "

"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"You should see that the data contains four columns called **dadsleep**, **babysleep**, **dadgrump**, and **day**. This is data set created by Danielle Navarrro in her textbook that explores the factors that lead to the dad being grumpy (Brenden has a 1 year old at home, so this data is also relevent to him!)."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n", " Delete this text and put your answer here. The code for your analysis should appear in the cells below.\n", "

\n",
" **Question 2**

\n", " When we do a regression there are two types of variables. Some variables are known as features or predictors. Often a single variable is known as the response variable or the predicted value. If we are interested in what makes the dad grumpy what are the predictors and what is the response variable?\n", "

"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n", " When we do a regression there are two types of variables. Some variables are known as features or predictors. Often a single variable is known as the response variable or the predicted value. If we are interested in what makes the dad grumpy what are the predictors and what is the response variable?\n", "

\n",
" **Your Answer**

\n", " Delete this text and put your answer here. The code and/or text for your analysis should appear in the cells below.\n", "

"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Let's look at the data! Te first step of exploratory data analysis is often to look at your data. "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n", " Delete this text and put your answer here. The code and/or text for your analysis should appear in the cells below.\n", "

\n",
" **Question 3**

\n", " Using the seaborn `scatterplot()` command, make a scatter plots of how grumpiness changes for each of the three other variables.

"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n", " Using the seaborn `scatterplot()` command, make a scatter plots of how grumpiness changes for each of the three other variables.

\n",
" **Your Answer**

\n", " Delete this text and put your answer here. The code and/or text for your analysis should appear in the cells below.

"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n", " Delete this text and put your answer here. The code and/or text for your analysis should appear in the cells below.

\n",
" **Question 4**

\n", " Based on your exploratory view of the data what do you think are the key relationships within this data set?\n", "

"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n", " Based on your exploratory view of the data what do you think are the key relationships within this data set?\n", "

\n",
" **Your Answer**

\n", " Delete this text and put your answer here. The code and/or text for your analysis should appear in the cells below.

"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Simple Linear Regression\n",
"\n",
"Simple linear regression is an approach for predicting a **quantitative response** using a **single feature** (or \"predictor\" or \"input variable\"). It takes the following form:\n",
"\n",
"$y = \\beta_0 + \\beta_1x$\n",
"\n",
"What does each term represent?\n",
"- $y$ is the response\n",
"- $x$ is the feature\n",
"- $\\beta_0$ is the intercept\n",
"- $\\beta_1$ is the coefficient for x\n",
"\n",
"Together, $\\beta_0$ and $\\beta_1$ are called the **model coefficients**. To create your model, you must \"learn\" the values of these coefficients. And once we've learned these coefficients, we can use the model to make predictions!"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"What do you mean by \"learn\"? Well you are probably more familiar with the phrase \"fit\" meaning we adjust the settings of the model coefficients (aka as parameters) until the line seems like a good summary of the data. Fitting thus mean adjusting some internal numbers so that the better reflect the underlying data set. Well when a human (or machine) learns it, it is in some sense of the same thing. We change the connections of the weights (or parameters) inside our brains to help us better predict our environment. For instance if your roommate is prone to late night partying and being grumpy the next day you might mentally fit a model to the experiences you have and \"learn\" what features are predictive of them being grumpy. So basically fitting a linear regression model is the same as doing basic machine learning! Wow!"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Manipulate the fitting by hand"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Before we get into using the computer to \"fit\" our data, let's start simple and do things by hand."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"@widgets.interact(slope=widgets.IntSlider(min=-20, max=20, step=1, value=0), intercept=widgets.IntSlider(min=0, max=200, step=1, value=50))\n",
"def plot_grumpiness(slope, intercept):\n",
" predict = intercept+slope*ph_df.dadsleep\n",
" resid = ph_df.dadgrump-predict\n",
" fig, ax = plt.subplots(figsize=(9,6))\n",
"\n",
" x1 = np.linspace(ph_df.dadsleep.min(), ph_df.dadsleep.max(),400)\n",
" y1 = intercept+slope*x1\n",
"\n",
" ax.plot(ph_df.dadsleep, ph_df.dadgrump,'ko',markersize=4)\n",
" #ax.plot(ph_df.dadsleep, ph_df.dadgrump-resid,'o',markersize=4,markeredgecolor='r', markeredgewidth=.4, markerfacecolor='white')\n",
"\n",
" ax.plot(x1,y1,'-',color='steelblue',linewidth=1)\n",
" plt.xlabel(\"dad sleep\")\n",
" plt.ylabel(\"dad grumpiness\")\n",
"\n",
" #ax.vlines(ph_df.dadsleep, ph_df.dadgrump, ph_df.dadgrump-resid,'r',linewidth=0.5)\n",
" plt.show()\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n", " Delete this text and put your answer here. The code and/or text for your analysis should appear in the cells below.

\n",
" **Question 5**

\n", " Using the slider above, adjust the location of the line to best fit the data represented by the black dots. What value did you get for the slope and intercept?\n", "

"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n", " Using the slider above, adjust the location of the line to best fit the data represented by the black dots. What value did you get for the slope and intercept?\n", "

\n",
" **Your Answer**

\n", " Delete this text and put your answer here. The code and/or text for your analysis should appear in the cells below\n", "

"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The next plot show what are known as the **residuals** between the actual data points (black) and the regression line (blue). As you can see the total amount of red changes depending on which line you use. "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"@widgets.interact(slope=widgets.IntSlider(min=-20, max=20, step=1, value=0), intercept=widgets.IntSlider(min=0, max=200, step=1, value=50))\n",
"def plot_grumpiness(slope, intercept):\n",
" predict = intercept+slope*ph_df.dadsleep\n",
" resid = ph_df.dadgrump-predict\n",
" fig, ax = plt.subplots(figsize=(9,6))\n",
"\n",
" x1 = np.linspace(ph_df.dadsleep.min(), ph_df.dadsleep.max(),400)\n",
" y1 = intercept+slope*x1\n",
"\n",
" ax.plot(ph_df.dadsleep, ph_df.dadgrump,'ko',markersize=4)\n",
" ax.plot(ph_df.dadsleep, ph_df.dadgrump-resid,'o',markersize=4,markeredgecolor='r', markeredgewidth=.4, markerfacecolor='white')\n",
"\n",
" ax.plot(x1,y1,'-',color='steelblue',linewidth=1)\n",
" plt.xlabel(\"dad sleep\")\n",
" plt.ylabel(\"dad grumpiness\")\n",
"\n",
" ax.vlines(ph_df.dadsleep, ph_df.dadgrump, ph_df.dadgrump-resid,'r',linewidth=0.5)\n",
" plt.show()\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n", " Delete this text and put your answer here. The code and/or text for your analysis should appear in the cells below\n", "

\n",
" **Question 6**

\n", " Find the best fit line you found from the plot above and compare it to different settings of the parameters. What do you notice about the lines that seem to fit well and the overall amount of red int he plot?\n", "

"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n", " Find the best fit line you found from the plot above and compare it to different settings of the parameters. What do you notice about the lines that seem to fit well and the overall amount of red int he plot?\n", "

\n",
" **Your Answer**

\n", " Delete this text and put your answer here. The code and/or text for your analysis should appear in the cells below

"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Estimating (\"Learning\") Model Coefficients"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The mechanics of fitting a line to some data (aka as \"learning\" the model coefficients or parameters) is best left to the computer. The reason is that for some dataset what is the \"best fit\" line might end up being too subjective (different people would prefer a different line). Also when we get to doing fMRI analysis you might repeat the regression for hundreds of thousands of individual voxels. This would take a lot of tinkering by hand to solve.\n",
"\n",
"Generally speaking, coefficients are estimated using the **least squares criterion**, which means we are find the line (mathematically) which minimizes the **sum of squared residuals** (or \"sum of squared errors\"):\n",
"\n",
"![](images/08_estimating_coefficients.png)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"What elements are present in the diagram?\n",
"- The black dots are the **observed values** of x and y.\n",
"- The blue line is our **least squares line**.\n",
"- The red lines are the **residuals**, which are the distances between the observed values and the least squares line.\n",
"\n",
"How do the model coefficients relate to the least squares line?\n",
"- $\\beta_0$ is the **intercept** (the value of $y$ when $x$=0)\n",
"- $\\beta_1$ is the **slope** (the change in $y$ divided by change in $x$)\n",
"\n",
"Here is a graphical depiction of those calculations:\n",
"\n",
"![](images/08_slope_intercept.png)\n",
""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Let's use the **statmodels** python package to estimate the model coefficients (aka \"fit\" the model) instead!"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# this is the standard import if you're using \"formula notation\" (similar to R)\n",
"\n",
"# create the fitted model in one line\n",
"lm = smf.ols(formula='dadgrump ~ dadsleep', data=ph_df).fit()\n",
"\n",
"print(lm.params)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"A couple of points here... First is that we use the `smf.ols()` function which does an \"ordinary least squares\" fit. This is the type of fit which tries to minimze the sum of the squared residuals. There are other types of fitting proceedures such as weighted least squares which is used when you expect the variance of the predicted variable to changes with the input predictor as well as its mean value. We don't worry abou that for this class though.\n",
"\n",
"The second is that we provide the `ols()` function with the pandas dataframe we are working with (`ph_df` according to the instructions in the first step of the lab) and then provide a formula. The formula expresses our \"model\" and is which variables in the data frame we are trying to relate. Here the formula `dadgrump ~ dadsleep` means that we want to predict `dadgrump` values given `dadsleep` values. So you think of `dadgrump` as our \"y value\" and `dadsleep` are our x value. "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n", " Delete this text and put your answer here. The code and/or text for your analysis should appear in the cells below

\n",
" **Question 7**

\n", " Look at the output parameters from the ols fitting proceedure. How do they compare to the ones you fitted by hand?\n", "

"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n", " Look at the output parameters from the ols fitting proceedure. How do they compare to the ones you fitted by hand?\n", "

\n",
" **Your Answer**

\n", " Delete this text and put your answer here. The code and/or text for your analysis should appear in the cells below

"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Interpret an OLS Regression fit"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Ok, so we did a model fit. We are like totally machine learning experiments now since we taught a model! But the cool thing about linear regression is that the model strucutre is *easily interpretable*. So what can we learn from the fit?"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Interpreting Model Coefficients\n",
"\n",
"How do we interpret the `dadsleep` coefficient?\n",
"- A \"unit\" increase in hours data sleep is **associated with** a -8.9367 \"unit\" decrease (because it is negative) in grumpiness. This kind of make sense. More sleep = less grumpy!\n",
"\n",
"\n",
"Note that if an increase in sleep was associated with a **increase** in grumpiness, the `dadsleep` coefficient would be **positive**.\n",
"\n",
"The `Intercept` coefficent is 125.95. This means that if dad gets no sleep at all his grumpiness will be at a very high level of 125.95! Bad news."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Using the Model for Prediction\n",
"\n",
"Let's say that mom comes into the picture here. Mom wants to anticipate how grumpy dad will be today. So she measures his sleep last night and finds that he slept 6 hours. What is her best guess about what the grumpiness level will be today?\n",
"\n",
"Well she could go back to the data and find a similar day where dad got 6 hours of sleep and average those together or grab one at random and repeat the same guess. However, since we just fit our linear regression equation we can use that model for prediction. In particular, remember:\n",
"\n",
"$$y = \\beta_0 + \\beta_1x$$\n",
"$$y = 125.956292 + -8.936756 \\times 6$$"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n", " Delete this text and put your answer here. The code and/or text for your analysis should appear in the cells below

\n",
" **Question 8**

\n", " Use your python calculator skills to predict the level of grumpiness for a dad who got 6 hours of sleep. Why is using the regression line a better way to make predictions than to grab similar cases and just use those?\n", "

"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n", " Use your python calculator skills to predict the level of grumpiness for a dad who got 6 hours of sleep. Why is using the regression line a better way to make predictions than to grab similar cases and just use those?\n", "

\n",
" **Your Answer**

\n", " Delete this text and put your answer here. The code and/or text for your analysis should appear in the cells below

"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Of course, we can also use Statsmodels to make the prediction:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# you have to create a DataFrame since the Statsmodels formula interface expects it\n",
"X_new = pd.DataFrame({'dadsleep': [6]})\n",
"X_new.head()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"lm.predict(X_new)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Plotting the least squares regression line"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Let's take a look at the best fit line. There are two very easy ways to do this. One is using seaborn's regplot which includes within the function an entire step to plot the regression line:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"sns.regplot(x='dadsleep',y='dadgrump',data=ph_df)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Alternatively if we are concerned the maybe we don't understand exactly what seaborn is doing we can plot the output of our fit from the `ols()` command:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"fig, ax = plt.subplots(figsize=(9,6))\n",
"\n",
"# create a DataFrame with the minimum and maximum values of sleep\n",
"x1 = pd.DataFrame({'dadsleep': [ph_df.dadsleep.min(), ph_df.dadsleep.max()]})\n",
"y1 = lm.predict(x1) # predict for the two data points using the fitted model in lm\n",
"\n",
"ax.plot(ph_df.dadsleep, ph_df.dadgrump,'ko',markersize=4)\n",
"\n",
"ax.plot(x1,y1,'-',color='steelblue',linewidth=1)\n",
"plt.xlabel(\"dad sleep\")\n",
"plt.ylabel(\"dad grumpiness\")\n",
"\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Confidence in our Model\n",
"\n",
"Statsmodels calculates 95% confidence intervals for our model coefficients, which are interpreted as follows: If the population from which this sample was drawn was **sampled 100 times**, approximately **95 of those confidence intervals** would contain the \"true\" coefficient."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# print the confidence intervals for the model coefficients\n",
"lm.conf_int()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Keep in mind that we only have a **single sample of data**, and not the **entire population of data**. The \"true\" coefficient is either within this interval or it isn't, but there's no way to actually know. We estimate the coefficient with the data we do have, and we show uncertainty about that estimate by giving a range that the coefficient is **probably** within.\n",
"\n",
"Note that using 95% confidence intervals is just a convention. You can create 90% confidence intervals (which will be more narrow), 99% confidence intervals (which will be wider), or whatever intervals you like."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Hypothesis Testing and p-values\n",
"\n",
"Closely related to confidence intervals is **hypothesis testing**. Generally speaking, you start with a **null hypothesis** and an **alternative hypothesis** (that is opposite the null). Then, you check whether the data supports **rejecting the null hypothesis** or **failing to reject the null hypothesis**.\n",
"\n",
"(Note that \"failing to reject\" the null is not the same as \"accepting\" the null hypothesis. The alternative hypothesis may indeed be true, except that you just don't have enough data to show that.)\n",
"\n",
"As it relates to model coefficients, here is the conventional hypothesis test:\n",
"- **null hypothesis:** There is no relationship between dad sleep and grumpiness (and thus $\\beta_1$ equals zero)\n",
"- **alternative hypothesis:** There is a relationship between dad sleep and dad grumpinss (and thus $\\beta_1$ is not equal to zero)\n",
"\n",
"How do we test this hypothesis? Intuitively, we reject the null (and thus believe the alternative) if the 95% confidence interval **does not include zero**. Conversely, the **p-value** represents the probability that the coefficient is actually zero:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# print the p-values for the model coefficients\n",
"lm.pvalues"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"If the 95% confidence interval **includes zero**, the p-value for that coefficient will be **greater than 0.05**. If the 95% confidence interval **does not include zero**, the p-value will be **less than 0.05**. Thus, a p-value less than 0.05 is one way to decide whether there is likely a relationship between the feature and the response. (Again, using 0.05 as the cutoff is just a convention.)\n",
"\n",
"In this case, the p-value for dad sleep is far less than 0.05, and so we **believe** that there is a relationship between sleep and grumpiness.\n",
"\n",
"Note that we generally ignore the p-value for the intercept."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## How Well Does the Model Fit the data?\n",
"\n",
"The most common way to evaluate the overall fit of a linear model is by the **R-squared** value. R-squared is the **proportion of variance explained**, meaning the proportion of variance in the observed data that is explained by the model, or the reduction in error over the **null model**. (The null model just predicts the mean of the observed response, and thus it has an intercept and no slope.)\n",
"\n",
"R-squared is between 0 and 1, and higher is better because it means that more variance is explained by the model. Here's an example of what R-squared \"looks like\" fit to a different dataset:"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"![](images/08_r_squared.png)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"You can see that the **blue line** explains some of the variance in the data (R-squared=0.54), the **green line** explains more of the variance (R-squared=0.64), and the **red line** fits the training data even further (R-squared=0.66). (Does the red line look like it's overfitting?)\n",
"\n",
"Let's calculate the R-squared value for our simple linear model:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# print the R-squared value for the model\n",
"lm.rsquared"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Is that a \"good\" R-squared value? It's hard to say. The threshold for a good R-squared value depends widely on the domain. Therefore, it's most useful as a tool for **comparing different models**."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"So far we have been pulling information from our fitted model piece by piece. However, there is a nice summary command that lets you access a bunch of information about your regression at once."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"lm.summary()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This include most of the numbers we discussed above and a few more things discussed in the book chapter reading on regression."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n", " Delete this text and put your answer here. The code and/or text for your analysis should appear in the cells below

\n",
" **Question 9**

\n", " You know know the basics of linear regression! Congrats. Now I want you to work on analyzing a new data set in the same way. All the pieces you need are above or we have encountered in previous lab. Please obtain the dataset on advertising available as a CSV here: https://cims.nyu.edu/~brenden/courses/labincp/data/advertising.csv\n", "\n", " \n", "

"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"A hint: what are the **features**?\n",
"- TV: advertising dollars spent on TV for a single product in a given market (in thousands of dollars)\n",
"- Radio: advertising dollars spent on Radio\n",
"- Newspaper: advertising dollars spent on Newspaper\n",
"\n",
"What is the **response**?\n",
"- Sales: sales of a single product in a given market (in thousands of widgets)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n", " You know know the basics of linear regression! Congrats. Now I want you to work on analyzing a new data set in the same way. All the pieces you need are above or we have encountered in previous lab. Please obtain the dataset on advertising available as a CSV here: https://cims.nyu.edu/~brenden/courses/labincp/data/advertising.csv\n", "\n", " \n", "

- \n",
"
- Read in the data frame \n", "
- Look at the structure of the columns (note the column names are case sensitive) \n", "
- Plot the relationship between TV advertising and Sale, the relationship between Radio and Sales, and the relationship between Newspaper and Sales. What does this visual exploration of the data suggest? (bonus if you can use subplots() to make it a single figure) \n", "
- Perform a separate simple OLS regression of each of the three feature sets on the response variable. Remember that you might want to call your variables different names to keep things separate. For isntance instead of storing the result of each regression in a varable called
**lm**you might want a different lm variable names for each of the simple regressions you run \n",
" - Plot the best fit line for each of the three patterns \n", "
- Describe the best fitting parameters for each of the three dataset. What are the coefficients in each model, are the slopes different than zero (given the hypothesis test)? What is the R^2 value? \n", "
- In a markdown cell write a brief summary of what you think is going on in this data. What types of advertising are most effective for sales? If you had a limited budget which one would you focus your advertising dollars on? \n", "\n", "

\n",
" **Your Answer**

\n", " Delete this text and put your answer here. The code for your analysis should appear in the cells below.\n", "

"
]
}
],
"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.7.9"
},
"toc": {
"base_numbering": 1,
"nav_menu": {},
"number_sections": true,
"sideBar": true,
"skip_h1_title": false,
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {},
"toc_section_display": true,
"toc_window_display": false
}
},
"nbformat": 4,
"nbformat_minor": 2
}
\n", " Delete this text and put your answer here. The code for your analysis should appear in the cells below.\n", "