From 73aff20a439289f3b2472a5c80fcb053eb6758b8 Mon Sep 17 00:00:00 2001 From: aaaakshat <33050725+aaaakshat@users.noreply.github.com> Date: Thu, 21 Oct 2021 12:28:09 -0400 Subject: [PATCH] Add pdf/cdf of ERV --- ch04.r | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/ch04.r b/ch04.r index c0ee293..138d3bd 100644 --- a/ch04.r +++ b/ch04.r @@ -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)