Skip to content

Commit

Permalink
Add pdf/cdf of ERV
Browse files Browse the repository at this point in the history
  • Loading branch information
aaaakshat committed Oct 21, 2021
1 parent 57175db commit 73aff20
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions ch04.r
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
# Chapter 4.3 (Cumulative Distribution Function)

## CDF of a Gaussian mixture
## 4.10 CDF of a Uniform Random Variable

# R code to generate the PDF and CDF
x = seq(-5, 10, (15)/1500)
x = seq(-5, 10, (5+10)/1500)
f = dunif(x, -3, 4)
F = punif(x, -3, 4)
plot(x, f, type="n")
lines(x, f, lwd=5)
plot(x, F, type="n")
lines(x, F, lwd=5)

## 4.11 CDF of an exponential random variable

# R code to generate the PDF and CDF
x = seq(-5, 10, (5+10)/1500)
f = dexp(x, 1/2)
F = pexp(x, 1/2)
plot(x, f, type="n")
lines(x, f, lwd=5)
plot(x, F, type="n")
lines(x, F, lwd=5)

0 comments on commit 73aff20

Please sign in to comment.