overlaying exponential distribution onto histogram

后端 未结 1 2018
耶瑟儿~
耶瑟儿~ 2021-01-22 05:43

How can i overlay an exponential distribution on a histogram of time intervals? The histogram looks like an exponential distribution. When I try to create the histogram in a sim

1条回答
  •  离开以前
    2021-01-22 06:30

    Make sure to use prob = TRUE in hist, and add = TRUE in curve

    z <- rexp(300,rate = 0.09)
    hist(z, prob = TRUE)
    curve(dexp(x, rate = 0.09), col = 2, lty = 2, lwd = 2, add = TRUE)
    

    enter image description here

    0 讨论(0)
提交回复
热议问题