R的幂律分布

时间:2017-05-03 14:24:53

标签: r power-law

我尝试使用以下R代码可视化幂律p(x)= x ^( - 2.5)。当您最终使用对数刻度时,您可以获得很多振动,这可以在这里看到here

但是知道,这是我的问题,我读了一篇文章,其中作者说我必须使用累积分布函数来消除这种振动。但对我而言,它不起作用,如here

所示
library(ggplot2)

chol_r <- read.table("C:\\Users\\me\\Desktop\\1M_just_random_py.txt", 
                   header = FALSE)


chol <- (chol_r)**(-2.5) #this p(x)
chol2 = (1/1.5)*chol_r**(-1.5) # the cumulative  distribution function

qplot(chol2,
      geom="histogram",
      binwidth = 0.001, #0.001 oder 0.38
      main = "Histogram",
      xlab = "Numbers",
      fill=I("blue"),
      col=I("red"),
      log="xy")

那么有人知道我做错了什么吗?或者我如何在没有这种振动的情况下获得直线下降?我真的不知道我做错了什么

0 个答案:

没有答案