class: center, middle, inverse, title-slide # Continuous Random Variables ### Dr. Dogucu --- layout: true <div class="my-header"></div> <div class="my-footer"> Copyright © <a href="https://mdogucu.ics.uci.edu">Dr. Mine Dogucu</a>. <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/">CC BY-NC-SA 4.0</a></div> --- class: middle ## Continuous Random Variables A continuous random variable `\(X\)` would have a sample space ( `\(S_X\)` ) that is uncountably infinite. -- Let X be the the proportion of bike owners on campus. Then `\(S_x = [0, 1]\)`. -- Let Y be the the survival time after some surgery. Then `\(S_Y = [0, \infty)\)`. --- ## Probability Density Function (pdf) - `\(f(x)\)` A probability __density__ function gives the relative likelihood of the continuous random variable within the sample space. `$$f(x) \geq0 \text{ for all } x \ \epsilon \ S_X$$` -- `$$\int_{x \ \epsilon \ S_X} f(x)dx = 1$$` -- `$$P(X\ \epsilon \ B) = \int_{x \ \epsilon \ B} f(x)dx$$` --- ## Example - pdf .pull-left[ <img src="img/cont_f.png" width="90%" style="display: block; margin: auto;" /> ] .pull-right[ <img src="slide-3-cont-rv_files/figure-html/unnamed-chunk-2-1.png" style="display: block; margin: auto;" /> ] -- `\(x^2 \geq0\)` -- `\((1-x) \geq0\)` -- <svg style="height:0.8em;top:.04em;position:relative;" viewBox="0 0 512 512"><path d="M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"/></svg> `\(f(x) \geq0 \text{ for all } x \ \epsilon \ S_X\)` --- ## Area Under the Curve = 1 .pull-left[ <img src="img/cont_f.png" width="90%" style="display: block; margin: auto;" /> ] .pull-right[ <img src="slide-3-cont-rv_files/figure-html/unnamed-chunk-4-1.png" style="display: block; margin: auto;" /> ] -- `\(\int_0^1 12(x^2)(1-x)dx\)` -- `\(12\int_0^1 (x^2-x^3)dx\)` -- `\(12\big[\frac{x^3}{3} -\frac{x^4}{4}\bigg\rvert_0^1\big] = 1\)` -- <svg style="height:0.8em;top:.04em;position:relative;" viewBox="0 0 512 512"><path d="M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"/></svg> `\(\int_{x \ \epsilon \ S_X} f(x)dx = 1\)` --- ## Probability is Area Under the Curve .pull-right[ <img src="img/cont_f.png" width="90%" style="display: block; margin: auto;" /> <img src="slide-3-cont-rv_files/figure-html/unnamed-chunk-6-1.png" style="display: block; margin: auto;" /> ] `\(P(0.25<X<0.50) =\)` `\(\int_{0.25}^{0.50} 12(x^2)(1-x)dx\)` -- `\(12\int_{0.25}^{0.50} (x^2-x^3)dx\)` -- `\(12\big[\frac{x^3}{3} -\frac{x^4}{4}\bigg\rvert_{0.25}^{0.50}\big] = 0.2617188\)` -- <svg style="height:0.8em;top:.04em;position:relative;" viewBox="0 0 512 512"><path d="M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"/></svg> `\(P(X\ \epsilon \ B) = \int_{x \ \epsilon \ B} f(x)dx\)` --- ## `\(P(X=x_i) = 0\)` .pull-right[ <img src="img/cont_f.png" width="90%" style="display: block; margin: auto;" /> <img src="slide-3-cont-rv_files/figure-html/unnamed-chunk-8-1.png" style="display: block; margin: auto;" /> ] `\(P(X=0.40) =\)` `\(\int_{0.40}^{0.40} 12(x^2)(1-x)dx\)` -- `\(12\int_{0.40}^{0.40} (x^2-x^3)dx\)` -- `\(12\big[\frac{x^3}{3} -\frac{x^4}{4}\bigg\rvert_{0.40}^{0.40}\big] = 0\)` --- ## cdf .pull-right[ <img src="img/cont_f.png" width="90%" style="display: block; margin: auto;" /> <img src="slide-3-cont-rv_files/figure-html/unnamed-chunk-10-1.png" style="display: block; margin: auto;" /> ] `\(P(X\leq x) = \int_l^x f(t)dt\)` `\(P(X\leq 0.70) =\)` `\(\int_{0}^{0.70} 12(t^2)(1-t)dt\)` -- `\(12\big[\frac{t^3}{3} -\frac{t^4}{4}\bigg\rvert_{0}^{0.70}\big] = 0.6516996\)` -- Note: `\(f(x) = \frac{dF(x)}{dx}\)` --- ## Expected Value `\(E(X) = \int_{x \ \epsilon \ S_X} xf(x)dx\)` -- `\(\int_0^1 x12(x^2)(1-x)dx\)` -- `\(12\int_0^1 (x^3-x^4)dx\)` -- `\(12\big[\frac{x^4}{4} -\frac{x^5}{5}\bigg\rvert_0^1\big] = 0.6\)` --- ## Variance `\(Var(X) = E(X^2)- [E(X)]^2\)` -- `\(E(X^2) = ?\)` -- `\(E(X^2) = \int_0^1 x^212(x^2)(1-x)dx\)` -- `\(E(X^2) = 12\int_0^1 (x^4-x^5)dx\)` -- `\(E(X^2) = 12\big[\frac{x^5}{5} -\frac{x^6}{6}\bigg\rvert_0^1\big] = 0.4\)` -- `\(Var(X) = 0.4- 0.6^2 = 0.04\)`