Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy
- from matplotlib import pyplot
- from scipy import stats
- def test (n,k,ns):
- r=stats.expon.rvs(loc =0, size = (ns,n),scale = 10)
- rr=numpy.sort(r, axis = 1)
- est_scale = (numpy.sum( rr[:,0:k],axis=1 )+(n-k)*rr[:,k-1])/k
- pyplot.figure()
- pyplot.hist(est_scale,bins = 30)
- pyplot.title( str(k)+" z "+str(n) )
- pyplot.show()
- print(n,k,numpy.mean(est_scale))
- test(10,10,10000)
- test(10,5,10000)
- test(10,2,10000)
- test(100,50,10000)
- test(100,10,10000)
- test(100,5,10000)
- test(100,1,10000)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement