# Overlay cdf

4 messages
Open this post in threaded view
|

## Overlay cdf

 Hi, Is it possible to  overlay a cummulative distribution function on a histogram of a gamma distribuition. I have a gamma function Sample = rgamma(1000,2.5,.8)+1.5 hist(Sample) regards
Open this post in threaded view
|

## Re: Overlay cdf

 Here are some ideas you might like to consider par(mar = c(5,4,2,4)+0.1, yaxs = "r") Sample <- rgamma(1000,2.5,.8) hist(Sample, main = "", freq = FALSE, ylim = c(0,1)) pu <- par("usr")[1:2] x <- seq(pu[1], pu[2], len = 5000) y <- pgamma(x, 2.5, 0.8) par(new = TRUE) plot(x, y, type = "l", axes = FALSE, ann = FALSE, col = "red") lines(x, dgamma(x, 2.5, 0.8), col = "darkgreen") axis(4, col = "red") mtext(side = 4, text = "Cumulative probability", col = "red", line = 2.5) x0 <- c(0, sort(Sample)) p0 <- 0:1000/1000 lines(x0, p0, type = "S", col = "blue") Bill Venables http://www.cmis.csiro.au/bill.venables/  -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of beetle2 Sent: Wednesday, 13 May 2009 3:23 PM To: [hidden email] Subject: [R] Overlay cdf Hi, Is it possible to  overlay a cummulative distribution function on a histogram of a gamma distribuition. I have a gamma function Sample = rgamma(1000,2.5,.8)+1.5 hist(Sample) regards -- View this message in context: http://www.nabble.com/Overlay-cdf-tp23515551p23515551.htmlSent from the R help mailing list archive at Nabble.com. ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code. ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.