2

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

但是知道,这是我的问题,我读了一篇文章,作者说我必须使用累积分布函数来消除最后的这种振动。但对我来说它不起作用,可以在这里看到这里

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")

那么有人知道我做错了什么吗?或者我怎样才能在没有振动的情况下直线下降?我真的不知道我做错了什么

4

0 回答 0