Beispiel #1
0
def central_limit_theorem():
    y = []
    n=100
    for i in range(1000):
        r = expon.rvs(scale=1, size=n)
        rsum=np.sum(r)
        z=(rsum-n)/np.sqrt(n)
        y.append(z)
    
    plt.hist(y,color='grey')
    plt.savefig('central_limit_theorem.png')
Beispiel #2
0
def first_year():
    X=sta.norm(loc=950, scale=20)#generate random data in normal distribution whose expectation is 950 and standard deviation is 20
    wbread=[]
    for i in range(365):
        x=X.rvs(size=100)
        wbread.append(x[0])#get the random data for one day

    log(numpy.mean(wbread))#print mean value
    log(sta.skew(wbread))#print skew value 
    plt.hist(wbread,color='grey')
    plt.savefig('first_year.png')
Beispiel #3
0
def second_year():
	X=sta.norm(loc=950, scale=20)#generate random data in normal distribution whose expectation is 950 and standard deviation is 20
	wbread=[]
	for i in range(365):
		x=X.rvs(size=100)
		wbread.append(max(x))#get the random data for one day

	log(numpy.mean(wbread))#print mean value
	log(sta.skew(wbread))#print skew value
	plt.hist(wbread,color='grey')
	plt.savefig('second_year.png')
Beispiel #4
0
def central_limit_theorem():
    y = []
    n=100
    for i in range(1000):
        r = binom.rvs(n, 0.3)
        rsum=np.sum(r)
        z=(rsum-n*0.3)/np.sqrt(n*0.3*0.7)
        y.append(z)
    
    plt.hist(y,color='grey')
    plt.savefig('central_limit_theorem.png')