Created
August 28, 2012 15:36
-
-
Save arivero/3499187 to your computer and use it in GitHub Desktop.
estadistica de una distribucion de nodos
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
if True: | |
informa=0 | |
print cantidad[:50] | |
print numero[:50] | |
ricos=sum(cantidad[:len(cantidad)/100]) | |
print "hemos repartido ", total , " entre ", sum(numero), | |
print " (media=",1.0*total/sum(numero), ")", reparto | |
print "el mas rico posee ", 1.0*cantidad[0]*sum(numero)/total, "veces mas que la media" | |
ricosnum,ricoscant,xx=0,0,-1 | |
for corte in 10000,1000,100,20,10,5,10.0/3,10.0/4,2,10.0/6,10.0/7,10.0/8,10.0/9,10.0/9.5,10.0/9.9: | |
while ricosnum<sum(numero)/corte: | |
xx+=1 | |
ricosnum+=numero[xx] | |
ricoscant+=cantidad[xx]*numero[xx] | |
resto=ricosnum-sum(numero)/corte | |
exacto=ricoscant-resto*cantidad[xx] | |
#print "el ", 100.0*ricosnum/sum(numero), "% posee el ", 100.0*ricoscant/total ,"%" | |
print "el", 100.0/corte, "% posee el ", "%02.2f"% (100.0*exacto/total) ,"%" | |
print "tenemos un array de ", len(numero), " elementos con ", | |
print sum(x==0 for x in numero), " ceros" | |
bins=[0,]*int(1+log(cantidad[0],2)) | |
while xx >= 0: | |
bins[int(log(cantidad[xx],2))]+=numero[xx] | |
xx-=1 | |
print bins | |
print ["%4.4f"%log(x+0.00000000001,2) for x in bins] | |
print ["%4.4f"%(log(bins[xt]+0.00000000001,2)-log(bins[xt+1]+0.00000000001,2)) for xt in range(len(bins)-1)] | |
print "====================================================================" |
Este gist es el de sumar los resultados. Para generar puedes usar por ejemplo este
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ojo que la info que sacamos de los bins implica ya una integracion, y por ello la diferencia de logs extrae el exponente de la distribucion acumulada y no de la pdf