<jupyter_start><jupyter_text>Symbulate Lab 5 - Central Limit Theorem This Jupyter notebook provides a template for you to fill in.  Read the notebook from start to finish, completing the parts as indicated.  To run a cell, make sure the cell is highlighted by clicking on it, then press SHIFT + ENTER on your keyboard.  (Alternatively, you can click the "play" button in the toolbar above.) In this lab you will use the Symbulate package.  You have seen most of the commands that you will use in previos labs, but remember to refer to the [documentation](https://dlsun.github.io/symbulate/index.html) for help.   In particular, read the documentation on [Normal distributions](https://dlsun.github.io/symbulate/common_continuous.htmlnormal), the [standardize method](https://dlsun.github.io/symbulate/rv.htmlstandardize), and the [`**` (exponentiation) notation](https://dlsun.github.io/symbulate/probspace.htmlIndependent-probability-spaces) for drawing multiple values independently from a distribution. **You should Symbulate commands whenever possible.**  If you find yourself writing long blocks of Python code, you are probably doing something wrong.  For example, you should not need to write any `for` loops.**Warning:** You may notice that many of the cells in this notebook are not editable. This is intentional and for your own safety. We have made these cells read-only so that you don't accidentally modify or delete them. However, you should still be able to execute the code in these cells.<jupyter_code>from symbulate import *
%matplotlib inline<jupyter_output><empty_output><jupyter_text>SetupA random sample of $n$ customers at the Avenue is selected.  Let $\bar{X}$ represent the mean dollar amount spent by the $n$ customers in the sample.  In this lab, you will investigate the distribution of $\bar{X}$: how does the mean dollar amount spent vary over many samples of size $n$?Each of the parts assumes a different distribution for dollar amounts spent by individual customers.  Within each part you will investigate how the distribution of the sample mean changes as the sample size increases.In each simulation, you should first define a probability space so that an outcome represents the $n$ individual dollar amounts spent by the customers in a random sample.  You can assume the dollar amounts spent are independent from customer to customer, and each is amount is drawn from the specified distribution.  (We say that the dollar amounts in a random sample are **independent and identically distributed (i.i.d.)**)In much of this lab, you will only need to make small modifications from question to question.  But do make sure you take time to think about the output of each part before moving on.  In particular, be sure to note the scale on the horizontal axis on your plots.You will run a simulation for each question, but there are some parts for which you should be able to derive the distribution analytically.  You are encouraged to do this outside of class for practice.Some of the simulations will take some a minute or two to run, especially for the larger values of $n$, so please be patient.  You might want to run `.sim(10)` first to make sure your code works, and then you can change to `.sim(10000)`.  Part IAssume dollar amounts spent by individual customers can be modeled with a Normal distribution with mean 6.50 and standard deviation 1.71.  a)First assume just a single customer is selected at random, and let $X$ represent the dollar amount spent.  Use simulation to:- Plot the approximate distribution of $X$- Estimate its expected value and standard deviation- Estimate the probability that $X$ is more than 2 standard deviations greater than its expected value.<jupyter_code># Type all of your code for this problem in this cell.
# Feel free to add additional cells for scratch work, but they will not be graded.<jupyter_output><empty_output><jupyter_text>b)Now $n=2$ customers are selected at random, and $\bar{X}$ represents the mean dollar amount spent for the two customers.  Use simulation to:- Plot the approximate distribution of $\bar{X}$- Estimate its expected value and standard deviation- Estimate the probability that $\bar{X}$ is more than 2 standard deviations greater than its expected value.<jupyter_code># Type all of your code for this problem in this cell.
# Feel free to add additional cells for scratch work, but they will not be graded.<jupyter_output><empty_output><jupyter_text>c)Repeat part b) with $n=5$<jupyter_code># Type all of your code for this problem in this cell.
# Feel free to add additional cells for scratch work, but they will not be graded.<jupyter_output><empty_output><jupyter_text>d)Repeat part b) with $n=30$<jupyter_code># Type all of your code for this problem in this cell.
# Feel free to add additional cells for scratch work, but they will not be graded.<jupyter_output><empty_output><jupyter_text>e)Repeat part b) with $n=100$<jupyter_code># Type all of your code for this problem in this cell.
# Feel free to add additional cells for scratch work, but they will not be graded.<jupyter_output><empty_output><jupyter_text>f)How does increasing the sample size $n$ affect the distribution of $\bar{X}$?  **TYPE YOUR RESPONSE HERE.**  Part IIAssume the dollar amount spent by any individual customer is equally likely to be 4, 5, 6, 7, 8, or 9.  a)First assume just a single customer is selected at random, and let $X$ represent the dollar amount spent.  Use simulation to:- Plot the approximate distribution of $X$- Estimate its expected value and standard deviation- Estimate the probability that $X$ is more than 2 standard deviations greater than its expected value.<jupyter_code># Type all of your code for this problem in this cell.
# Feel free to add additional cells for scratch work, but they will not be graded.<jupyter_output><empty_output><jupyter_text>b)Now $n=2$ customers are selected at random, and $\bar{X}$ represents the mean dollar amount spent for the two customers.  Use simulation to:- Plot the approximate distribution of $\bar{X}$- Estimate its expected value and standard deviation- Estimate the probability that $\bar{X}$ is more than 2 standard deviations greater than its expected value.<jupyter_code># Type all of your code for this problem in this cell.
# Feel free to add additional cells for scratch work, but they will not be graded.<jupyter_output><empty_output><jupyter_text>c)Repeat part b) with $n=5$<jupyter_code># Type all of your code for this problem in this cell.
# Feel free to add additional cells for scratch work, but they will not be graded.<jupyter_output><empty_output><jupyter_text>d)Repeat part b) with $n=30$<jupyter_code># Type all of your code for this problem in this cell.
# Feel free to add additional cells for scratch work, but they will not be graded.<jupyter_output><empty_output><jupyter_text>e)Repeat part b) with $n=100$<jupyter_code># Type all of your code for this problem in this cell.
# Feel free to add additional cells for scratch work, but they will not be graded.<jupyter_output><empty_output><jupyter_text>f)How does increasing the sample size $n$ affect the distribution of $\bar{X}$?  **TYPE YOUR RESPONSE HERE.**  Part IIIAssume the dollar amount spent by any individual customer has an Exponential distribution with mean 6.50  a)First assume just a single customer is selected at random, and let $X$ represent the dollar amount spent.  Use simulation to:- Plot the approximate distribution of $X$- Estimate its expected value and standard deviation- Estimate the probability that $X$ is more than 2 standard deviations greater than its expected value.<jupyter_code># Type all of your code for this problem in this cell.
# Feel free to add additional cells for scratch work, but they will not be graded.<jupyter_output><empty_output><jupyter_text>b)Now $n=2$ customers are selected at random, and $\bar{X}$ represents the mean dollar amount spent for the two customers.  Use simulation to:- Plot the approximate distribution of $\bar{X}$- Estimate its expected value and standard deviation- Estimate the probability that $\bar{X}$ is more than 2 standard deviations greater than its expected value.<jupyter_code># Type all of your code for this problem in this cell.
# Feel free to add additional cells for scratch work, but they will not be graded.<jupyter_output><empty_output><jupyter_text>c)Repeat part b) with $n=5$<jupyter_code># Type all of your code for this problem in this cell.
# Feel free to add additional cells for scratch work, but they will not be graded.<jupyter_output><empty_output><jupyter_text>d)Repeat part b) with $n=30$<jupyter_code># Type all of your code for this problem in this cell.
# Feel free to add additional cells for scratch work, but they will not be graded.<jupyter_output><empty_output><jupyter_text>e)Repeat part b) with $n=100$<jupyter_code># Type all of your code for this problem in this cell.
# Feel free to add additional cells for scratch work, but they will not be graded.<jupyter_output><empty_output><jupyter_text>f)How does increasing the sample size $n$ affect the distribution of $\bar{X}$?  **TYPE YOUR RESPONSE HERE.**  Part IVNow suppose that for 99% of the customers, the amounts spent follow the distribution in Part II, but the remaining 1% of customers spend 31 dollars (maybe they treat a few friends to lunch).  (Hint: use a BoxModel.)  a)First assume just a single customer is selected at random, and let $X$ represent the dollar amount spent.  Use simulation to:- Plot the approximate distribution of $X$- Estimate its expected value and standard deviation- Estimate the probability that $X$ is more than 2 standard deviations greater than its expected value.<jupyter_code># Type all of your code for this problem in this cell.
# Feel free to add additional cells for scratch work, but they will not be graded.<jupyter_output><empty_output><jupyter_text>b)Now $n=2$ customers are selected at random, and $\bar{X}$ represents the mean dollar amount spent for the two customers.  Use simulation to:- Plot the approximate distribution of $\bar{X}$- Estimate its expected value and standard deviation- Estimate the probability that $\bar{X}$ is more than 2 standard deviations greater than its expected value.<jupyter_code># Type all of your code for this problem in this cell.
# Feel free to add additional cells for scratch work, but they will not be graded.<jupyter_output><empty_output><jupyter_text>c)Repeat part b) with $n=5$<jupyter_code># Type all of your code for this problem in this cell.
# Feel free to add additional cells for scratch work, but they will not be graded.<jupyter_output><empty_output><jupyter_text>d)Repeat part b) with $n=30$<jupyter_code># Type all of your code for this problem in this cell.
# Feel free to add additional cells for scratch work, but they will not be graded.<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.06458735854264422, 'fraction_numerical': 0.005612291839175637, 'mean_word_length': 5.076020122973729, 'pattern_counts': {'":': 0, '<': 81, '<?xml version=': 0, '>': 81, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '20', 'dir': 'jupyter-structured-clean-dedup', 'id': '311947', 'license': 'MIT', 'n_tokens_mistral': 2899, 'n_tokens_neox': 2789, 'n_words': 1560, 'path': 'labs/Lab 5 - Central Limit Theorem.ipynb', 'repo_name': 'ksachdeva/symbulate', 'size': '10869'}