2

I tried to visualize a Power Law p(x)=x^(-2.5) with following R code. When you use an log-scale in the end you get a lot of vibrations what is okay as can be seen here here

But know, and this is my Problem, I read an article where the author says I have to use a cumulative distribution function to remove this vibrations at the end. But for me it doesn't work, as can be seen 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")

So does anybody know what I am doing wrong? Or how i can get a straight line falling without that vibrations? I really don't know what I am doing wrong

Richard Telford
  • 9,558
  • 6
  • 38
  • 51
YGOG
  • 21
  • 2
  • What is in the text file, could you produce code to create this 1M_just_random_py file and where can I find that article? – Tobias Dekker May 03 '17 at 16:04
  • I used the Python command random() in a for loop to create the numbers. The article can be found here: [link] (https://arxiv.org/pdf/cond-mat/0412004.pdf) on page 3 and 4 the procedure is described – YGOG May 03 '17 at 16:26

0 Answers0