# Central Limit Theorem for R coding assignment

I had a homework assignment asking us to code some basic things in R. Here are the tasks:

1. Generate a Gamma(1,2) population of size N=5000 and show its density plot and descriptive statistics.
2. Create the sampling distribution of the sample mean from 200 samples, each of size n=35, drawn from the above population.
3. Show a density plot and descriptive statistics for this sampling distribution

I have already done the coding. But for the last question it asks, "Are your results in agreement with the central limit theorem (CLT)? Did you expect that?"

What should I be looking for exactly? I guess I don't fully understand the central limit theorem so I'm not really sure how to connect it to my results.

• Because this is a homework/self-study question, you should add the self-study tag to your question. See stats.stackexchange.com/tags/self-study/info Oct 23 '15 at 23:29
• Here's a quick demo of what you are asking for. Since this does look like a homework problem, I hope you wouldn't copy any code. github.com/saketkc/notebooks/blob/master/R/CLT.ipynb Oct 24 '15 at 0:46
• @user92981 that would be helpful to show the plots obtained at steps 1 and 3 Oct 24 '15 at 8:56

Let $X_i$ be the result of sampling from your gamma distribution on the $i$'th trial. Let $Y_i:=(X_i-\mu_i)/\sigma_i$, where $\mu_i=E[X_i]=E[X_1]$ and $\sigma_i$ is the standard deviation of $X_i$, both of which you know from the parameters of the gamma distribution.The central limit theorem says that
$$\frac{Y_1+\cdots+Y_n}{\sqrt{n}}\Rightarrow N(0,1).$$
$$Z_n=\frac{Y_1+\cdots+Y_n}{\sqrt{n}},$$
and then repeatedly sample $Z_n$ for some large $n$ (say, n=100), then the histogram (density plot) of $Z_n$'s should look roughly like a standard normal distribution. The larger $n$ is, the more accurate it should look.