<jupyter_start><jupyter_text>1. Graphic Illustration of some limit theorems, including   1) the law of large numbers;   2) the central limit theorem (VB, Theorem 1.3.2)   and more. Define a function that studies the asymptotic behavior of $X_1+...X_N$, where $X_1,...X_N$ are i.i.d random variables withh mean $0$.  In particular, we would like to visualize the behavior of $\frac{X_1+...X_N}{N^{\alpha}}$ for some $\alpha>0$.<jupyter_code># Define a function:
# Input: 1) a set of sample S with dimension n times m. n represents the number of samples and m represent the size of each sample;
#        2) the parameter alpha.
# Output: a histogram of realizations of (X_1+...+X_N)/N^alpha

def CLT(alpha, X):  
    # sum all the number in each sample:
    # Your codes go in here
    
    # divide by sample size to the power of alpha, (be careful on whether to divide by m or n):
    # Your codes go in here
    
    # plot the distribution with regard to alpha using sns.distplot(). If you are unfamiliar with the function, google the API for sns:
    # Your codes go in here<jupyter_output><empty_output><jupyter_text>Now test your function with $\alpha = 1 $ and $\alpha = \frac{1}{2}$ and  1) $X_i$ has standard normal distribution;  2) $X_i$ has symmetric Bernoulli distribution;  3) any other distribution of your preference for $X_i$.<jupyter_code># Your code goes here<jupyter_output><empty_output><jupyter_text>2. Graphic Illustration of the convergence rate in the central limit theorem (VB, Theorem 2.1.3 Berry-Esseen central limit theorem) Define a function to verify the quantitative central limit theorem by computing and comparing (graphically) the left hand side and right hand side of the theorem. In particular, we wouod like to analyze:$P(\frac{X_1 + ... + X_N - N \mu}{\sigma \sqrt{N}} > t) -  P(g >t)$, where $g \sim N(0,1)$. We recall that the probability of a random variable to take values in a range can be approximated by the frequencies of observations occurring in this range.  For simplicity, we would sutdy the case when the random variables $X_i$ are independent Possion(2).<jupyter_code># Define a function that computes for different N, the difference between 
# Input: t a positive number;
# Output: a graph showing the difference on the left hand side and the bound on the right hand side of Theorem 2.1.3. 
def CLT_diff(t):
    LHS_list = []
    RHS_list = []
    sigma = np.sqrt(2)
    # generate the constant appearing on the right hand side:
    # Your code goes here
    
    # compute the tail probability appearing on the right hand side:
    # Your code goes here
    
    # vary N from 2 to 50000 with step size 100, for each N and the given t, draw samples from possion(2) and approximate the probablity of interest on the left hand side: 
    # Your code goes here
    
    # After we get the result for each N, we plot the result
    # Your code goes here

# Test your function now:
# Your code goes here<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.07981220657276995, 'fraction_numerical': 0.014084507042253521, 'mean_word_length': 3.6609375, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 16, 'https://': 0, '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': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '528551', 'license': 'MIT', 'n_tokens_mistral': 885, 'n_tokens_neox': 854, 'n_words': 432, 'path': '3. Thursday/LimitTheorems.ipynb', 'repo_name': 'ArianNadjim/Tripods', 'size': '2982'}