Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Qstn-3.

1(PH16MSCST11014)

February 10, 2018

In [1]: import numpy as np


from scipy import stats
from matplotlib import pyplot as plt

In [2]: x=np.linspace(-8,8,100)
y=stats.norm.pdf(x,0,1)*3700
plt.plot(x,y,color='g',label='Normal dist.')
plt.xlim(-10,10)
N=10000
a=np.zeros((N))
for i in range(N):
data=stats.norm(0, 1).rvs(10)
a[i]=np.median(data)
plt.hist(a*2.5,20,histtype='step',color='black',label='median')
plt.title('Bootstrap sampling of median')
plt.xlabel('x')
plt.ylabel('y')
plt.legend()
plt.show()

1
2

You might also like