Distribution of sample statistics

Can anyone please guide me on how to draw the plot for displaying the variation of mean for varying number of sample size and samples in python?

Hi

Try following below steps

1.Iterate using β€œfor” loop for the values of n(ie., n throws.You can have it fro 1 to 100)

2.For every value of n above,you need n outputs from a die ie., random value from 1 to 6. You can achieve this from randint from np.random module.

3.For each value of n ,do it 1000 times as we need 1000 samples(ie., k).try having while loop (for number of samples ) inside above for loop

4.Create a list for the mean of each sample (ie., list of size 1000) and calculate variance of this list using np.var()

5.Have a dictonary that has n as keys and values as the variance you got in step 4 for varying size of n

6.Do a line plot between values and keys of dictionary created in step 5

Hope this helps.

3 Likes