Question: Empirical distribution of random sample means def simulate_sample_mean(table, label, sample_size, repetitions): means = make_array() for i in np.arange(repetitions): new_sample_mean = one_sample_mean(table, label, sample_size) means =
"""Empirical distribution of random sample means"""
def simulate_sample_mean(table, label, sample_size, repetitions): means = make_array()
for i in np.arange(repetitions): new_sample_mean = one_sample_mean(table, label, sample_size) means = np.append(means, new_sample_mean)
sample_means = Table().with_column('Sample Means', means) # Display empirical histogram and print all relevant quantities - don't change this! sample_means.hist(bins=20) plt.xlabel('Sample Means') plt.title('Sample Size ' + str(sample_size)) print("Sample size: ", sample_size) print("Population mean:", np.mean(table.column(label))) print("Average of sample means: ", np.mean(means)) print("Population SD:", np.std(table.column(label))) print("SD of sample means:", stats.tstd(means)) return stats.tstd(means)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
