2006-11-14から1日間の記事一覧

R言語でZipfの法則

R

R言語でジップの法則のヒストグラムを描く。 R help archive:Zipf random number generationより引用。 x0<-1:10000; t<-0.999; p<-((t^x0)/x0)/(-log(1-t)) Y<-sample(x0,5000,replace=TRUE,prob=p) hist(Y,breaks=100)