Use Rstudio to compare the cdf and pdf of an exponential random variable with rate λ=2λ=2 with the cdf and pdf of an exponential random variable with rate 1/2.
The PDF and CDF of exponential random variable is plotted below.
The R code below.
lamda <- 2
plot(1:1)
dev.new()
curve(dexp(x,rate = lamda), xlim=c(0,4), xlab="x", ylab="PDF &
CDF", main="Exponential distribution",lwd=2, col = "blue")
curve(pexp(x,rate = lamda), xlim=c(0,4), lwd=2, col = "red",
add=TRUE)
The PDF and CDF of exponential random variable is plotted below.
The R code below.
lamda <- 1/2
plot(1:1)
dev.new()
curve(dexp(x,rate = lamda), ylim=c(0,1.2),xlim=c(0,8), xlab="x",
ylab="PDF & CDF", main="Exponential distribution",lwd=2, col =
"blue")
curve(pexp(x,rate = lamda), xlim=c(0,8), lwd=2, col = "red",
add=TRUE)
Get Answers For Free
Most questions answered within 1 hours.