Last active
October 23, 2019 18:30
-
-
Save chaipi-chaya/902b01d6a48a612eaafaefddea18ef44 to your computer and use it in GitHub Desktop.
Illustration with Python Central Limit Theorem | expected value and standard deviation of sample means
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## expect value of sample | |
import numpy as np | |
# use last sampling | |
from diffSampleSize import meansample | |
# mean and standard deviation from population | |
shape, scale = 2., 2. # mean=4, std=2*sqrt(2) | |
sample = meansample[5] | |
# expected value of sample equal to expect value of population | |
print("expected value of sample:", np.mean(sample)) | |
print("expected value of population:", shape*scale) | |
# standard deviation of sample equl to standard deviation of population divided by squre root of n | |
print("standard deviation of sample:", np.std(sample)) | |
print("standard deviation of population:", scale*np.sqrt(shape)) | |
print("standard deviation of population divided by squre root of sample size:", scale*np.sqrt(shape)/np.sqrt(1000)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment