From 627b90772f71eeed18c10bef25abb5406cc8404b Mon Sep 17 00:00:00 2001 From: Humphrey Yang Date: Wed, 5 Jul 2023 14:50:18 +1000 Subject: [PATCH 1/3] fix date in the exercise --- day-04/exercise_set_4.ipynb | 95 +++++++++++++++++++---- day-04/exercise_set_4_with_solution.ipynb | 24 ++---- 2 files changed, 86 insertions(+), 33 deletions(-) diff --git a/day-04/exercise_set_4.ipynb b/day-04/exercise_set_4.ipynb index 0399051..7c0f72b 100644 --- a/day-04/exercise_set_4.ipynb +++ b/day-04/exercise_set_4.ipynb @@ -103,19 +103,7 @@ "source": [ "### Exercise 2\n", "\n", - "In this exercise, your tasks are the followings:\n", - "\n", - "**Exercise 2.1** Draw 1000 independent draws from the standard normal distribution using [`scipy.stats`](https://docs.scipy.org/doc/scipy/reference/stats.html).\n", - "\n", - "**Exercise 2.2** Calculate the sample mean and variance of the draws and compare them to the theoretical values.\n", - "\n", - "**Exercise 2.3** Visualize the empirical distribution of the draws using a histogram. Mark the sample mean and $\\pm$ one standard deviation using vertical lines.\n", - "\n", - "**Exercise 2.4** Calculate the probability that a draw from the distribution is less than 0 and compare it to the proportion of the sample that is less than 0.\n", - "\n", - "**Exercise 2.5** How do the results in question 3 change with different sample sizes? Try to draw 10, 100, 500, 1000, and 10000 samples. Repeat 100 times for each sample size and plot the results. What do you observe when comparing the sample estimates to the population parameters (the ground truth)?\n", - "\n", - "Use the following imports to get started." + "In this exercise, use the following imports to get started." ] }, { @@ -129,6 +117,83 @@ "from scipy.stats import norm" ] }, + { + "attachments": {}, + "cell_type": "markdown", + "metadata": {}, + "source": [ + "**Exercise 2.1** Draw 1000 independent draws from the standard normal distribution using [`scipy.stats`](https://docs.scipy.org/doc/scipy/reference/stats.html)." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# TODO: Put your solution here" + ] + }, + { + "attachments": {}, + "cell_type": "markdown", + "metadata": {}, + "source": [ + "**Exercise 2.2** Calculate the sample mean and variance of the draws and compare them to the theoretical values." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# TODO: Put your solution here" + ] + }, + { + "attachments": {}, + "cell_type": "markdown", + "metadata": {}, + "source": [ + "**Exercise 2.3** Visualize the empirical distribution of the draws using a histogram. Mark the sample mean and $\\pm$ one standard deviation using vertical lines." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# TODO: Put your solution here" + ] + }, + { + "attachments": {}, + "cell_type": "markdown", + "metadata": {}, + "source": [ + "**Exercise 2.4** Calculate the probability that a draw from the distribution is less than 0 and compare it to the proportion of the sample that is less than 0." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# TODO: Put your solution here" + ] + }, + { + "attachments": {}, + "cell_type": "markdown", + "metadata": {}, + "source": [ + "**Exercise 2.5** How do the results in question 3 change with different \n", + "sample sizes? Try to draw 10, 100, 500, 1000, and 10000 samples. Repeat 100 times for each sample size and plot the results. What do you observe when comparing the sample estimates to the population parameters (the ground truth)?" + ] + }, { "cell_type": "code", "execution_count": null, @@ -505,7 +570,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "On day 2, we generated 100000 data points from the [exponential distribution](https://en.wikipedia.org/wiki/Exponential_distribution) with density\n", + "On day 3, we generated 100000 data points from the [exponential distribution](https://en.wikipedia.org/wiki/Exponential_distribution) with density\n", "\n", "$$\n", "f(x; \\alpha) = \\alpha \\exp(-\\alpha x)\n", @@ -695,7 +760,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.13" + "version": "3.9.16" } }, "nbformat": 4, diff --git a/day-04/exercise_set_4_with_solution.ipynb b/day-04/exercise_set_4_with_solution.ipynb index 43ac2ab..6cd1df5 100644 --- a/day-04/exercise_set_4_with_solution.ipynb +++ b/day-04/exercise_set_4_with_solution.ipynb @@ -152,19 +152,7 @@ "source": [ "### Exercise 2\n", "\n", - "In this exercise, your tasks are the followings:\n", - "\n", - "**Exercise 2.1** Draw 1000 independent draws from the standard normal distribution using [`scipy.stats`](https://docs.scipy.org/doc/scipy/reference/stats.html).\n", - "\n", - "**Exercise 2.2** Calculate the sample mean and variance of the draws and compare them to the theoretical values.\n", - "\n", - "**Exercise 2.3** Visualize the empirical distribution of the draws using a histogram. Mark the sample mean and $\\pm$ one standard deviation using vertical lines.\n", - "\n", - "**Exercise 2.4** Calculate the probability that a draw from the distribution is less than 0 and compare it to the proportion of the sample that is less than 0.\n", - "\n", - "**Exercise 2.5** How do the results in question 3 change with different sample sizes? Try to draw 10, 100, 500, 1000, and 10000 samples. Repeat 100 times for each sample size and plot the results. What do you observe when comparing the sample estimates to the population parameters (the ground truth)?\n", - "\n", - "Use the following imports to get started." + "In this exercise, use the following imports to get started." ] }, { @@ -191,7 +179,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "**Exercise 2.1**" + "**Exercise 2.1** Draw 1000 independent draws from the standard normal distribution using [`scipy.stats`](https://docs.scipy.org/doc/scipy/reference/stats.html).\n" ] }, { @@ -213,7 +201,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "**Exercise 2.2**" + "**Exercise 2.2** Calculate the sample mean and variance of the draws and compare them to the theoretical values." ] }, { @@ -237,7 +225,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "**Exercise 2.3**" + "**Exercise 2.3** Visualize the empirical distribution of the draws using a histogram. Mark the sample mean and $\\pm$ one standard deviation using vertical lines." ] }, { @@ -259,7 +247,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "**Exercise 2.4**" + "**Exercise 2.4** Calculate the probability that a draw from the distribution is less than 0 and compare it to the proportion of the sample that is less than 0." ] }, { @@ -285,7 +273,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "**Exercise 2.5**" + "**Exercise 2.5** How do the results in question 3 change with different sample sizes? Try to draw 10, 100, 500, 1000, and 10000 samples. Repeat 100 times for each sample size and plot the results. What do you observe when comparing the sample estimates to the population parameters (the ground truth)?" ] }, { From 94287c62de8fd80e3a25226376e976b632112073 Mon Sep 17 00:00:00 2001 From: Humphrey Yang Date: Wed, 5 Jul 2023 14:53:34 +1000 Subject: [PATCH 2/3] update the question statement --- day-04/exercise_set_4.ipynb | 2 +- day-04/exercise_set_4_with_solution.ipynb | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/day-04/exercise_set_4.ipynb b/day-04/exercise_set_4.ipynb index 7c0f72b..da9969b 100644 --- a/day-04/exercise_set_4.ipynb +++ b/day-04/exercise_set_4.ipynb @@ -190,7 +190,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "**Exercise 2.5** How do the results in question 3 change with different \n", + "**Exercise 2.5** Will results in exercise 2.3 change with different \n", "sample sizes? Try to draw 10, 100, 500, 1000, and 10000 samples. Repeat 100 times for each sample size and plot the results. What do you observe when comparing the sample estimates to the population parameters (the ground truth)?" ] }, diff --git a/day-04/exercise_set_4_with_solution.ipynb b/day-04/exercise_set_4_with_solution.ipynb index 6cd1df5..61c3086 100644 --- a/day-04/exercise_set_4_with_solution.ipynb +++ b/day-04/exercise_set_4_with_solution.ipynb @@ -273,7 +273,8 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "**Exercise 2.5** How do the results in question 3 change with different sample sizes? Try to draw 10, 100, 500, 1000, and 10000 samples. Repeat 100 times for each sample size and plot the results. What do you observe when comparing the sample estimates to the population parameters (the ground truth)?" + "**Exercise 2.5** Will results in exercise 2.3 change with different \n", + "sample sizes? Try to draw 10, 100, 500, 1000, and 10000 samples. Repeat 100 times for each sample size and plot the results. What do you observe when comparing the sample estimates to the population parameters (the ground truth)?" ] }, { From 28e3dca5dcc27e892e4c9caf33b1f8f0271125b5 Mon Sep 17 00:00:00 2001 From: Humphrey Yang Date: Wed, 5 Jul 2023 14:55:50 +1000 Subject: [PATCH 3/3] add a new line --- day-04/exercise_set_4.ipynb | 4 +++- day-04/exercise_set_4_with_solution.ipynb | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/day-04/exercise_set_4.ipynb b/day-04/exercise_set_4.ipynb index da9969b..496ac9d 100644 --- a/day-04/exercise_set_4.ipynb +++ b/day-04/exercise_set_4.ipynb @@ -191,7 +191,9 @@ "metadata": {}, "source": [ "**Exercise 2.5** Will results in exercise 2.3 change with different \n", - "sample sizes? Try to draw 10, 100, 500, 1000, and 10000 samples. Repeat 100 times for each sample size and plot the results. What do you observe when comparing the sample estimates to the population parameters (the ground truth)?" + "sample sizes? \n", + "\n", + "Try to draw 10, 100, 500, 1000, and 10000 samples. Repeat 100 times for each sample size and plot the results. What do you observe when comparing the sample estimates to the population parameters (the ground truth)?" ] }, { diff --git a/day-04/exercise_set_4_with_solution.ipynb b/day-04/exercise_set_4_with_solution.ipynb index 61c3086..52920bf 100644 --- a/day-04/exercise_set_4_with_solution.ipynb +++ b/day-04/exercise_set_4_with_solution.ipynb @@ -274,7 +274,9 @@ "metadata": {}, "source": [ "**Exercise 2.5** Will results in exercise 2.3 change with different \n", - "sample sizes? Try to draw 10, 100, 500, 1000, and 10000 samples. Repeat 100 times for each sample size and plot the results. What do you observe when comparing the sample estimates to the population parameters (the ground truth)?" + "sample sizes? \n", + "\n", + "Try to draw 10, 100, 500, 1000, and 10000 samples. Repeat 100 times for each sample size and plot the results. What do you observe when comparing the sample estimates to the population parameters (the ground truth)?" ] }, {