Home > database >  In R - How to plot a PDF and CDF for exponential distribution given lambda=0.2 or theta=5 and N=10?
In R - How to plot a PDF and CDF for exponential distribution given lambda=0.2 or theta=5 and N=10?

Time:04-22

I don't know how to plot the probability distribution function (PDF) and the cumulative one given λ = 1/5 for N=10observations

CodePudding user response:

The 3 functions you are looking for are dexp(), qexp() and rexp(). Use the ? operator to get the help page for them.

Each stat distribution has the equivalent set of functions that define the density, quantiles (cumulative) and a data set.

R uses plot(x, y) notation to make a plot. If you are using Rstudio, you can use the GUI to save the image, else you can do:

png("name.png")
plot(x, y)
dev.off()

I'm not wholly confident on stack overflow's policy on answering homework questions, but I think this isn't overstepping. I think figuring out what goes on the x and y axes constitutes what you're supposed to figure out.

  • Related