I am trying to answer this question:
Assume that a sample is created from a standard normal distribution (μ= 0,σ= 1). Take sample lengths ranging from N = 1 to 600. For each sample length, draw 5000 samples and estimate the mean from each of the samples. Find the standard deviation from these means, and show that the standard deviation corresponds to a square root reduction.
I'm not sure if I am interpreting the question properly, but my goal is to find the standard deviation of the means for each sample length and then show that the decrease in standard deviation is similar to a square root reduction:
this is what I have so far (is what I'm doing making sense in relation to the problem?):
First making normal distribution and just plotting a simple one for reference:
import math
import numpy as np
import matplotlib.pyplot as plt
import xarray as xr
from scipy.stats import norm, kurtosis, skew
from scipy import stats
n = np.arange(1,401,1)
mu = 0
sigma = 1
x = np.linspace(mu - 4*sigma, mu + 4*sigma, 100)
pdf = stats.norm.pdf(x, mu, sigma)
# plot normal distribution
plt.plot(x,pdf)
plt.show()
now for the sample lengths etc and calculating the sdev and mean:
sample_means = []
sample_stdevs = []
for i in range(400):
rand_list = np.random.randint(1,400,1000) #samples ranging from values 1 - 400, and make a 1000 of them
sample_means.append(np.mean(rand_list))
sample_stdevs.append(np.std(sample_means))
plt.plot(sample_stdevs)
does this make sense?... also I am confused on the root reduction part.

