# make up some data
n <- rpoilog(1000, 1.0, 1.0)
# plot it
p <- ppplot(n)
p
# compare to the lognormal's fit
# first, make the empirical cumulative distribution function from the data
x <- tabulate(n + 1)
empirical <- cumsum(x / sum(x))
# then, get the theoretical percents
theoretical <- plnorm(0:max(n), meanlog=mean(log(n)), sdlog=sd(log(n)))
lognormal.fit <- data.frame(empirical=empirical, theoretical=theoretical)
# add that data in a new layer
p + geom_line(data=lognormal.fit, color='red')
Run the code above in your browser using DataLab