Random variables that can assume every value in an interval have continuous distributions. A continuous distribution can also be characterized by its probability density function (p.d.f.).
Many experiments or observations of random phenomenon do not have integers as outcomes, but instead are measurements selected from an interval of numbers. For example, you could find the length of time that it takes when waiting in line at the grocery store or the weight of a bag of potato chips advertised at 1 oz. If the measurements could come from an interval of possible outcomes, we call them continuous-type data.
A probability density function (pdf) is a function \(f\) such that:
Suppose \(f_{Y}(y)=4y^{3}\), \(0\leq y\leq 1\). Is this a valid probability distribution?
Yes.
<- seq(0,1, by=.01)
y <- 4*y^3
f.y plot(y, f.y)
<- function(y){4*y^3}
f.y integrate(f.y, lower=0, upper=1)
## 1 with absolute error < 1.1e-14
A continuous random variable \(X\) is a random variable described by a pdf in the sense that
\[ P(a \leq x \leq b) = \int_{a}^{b} f_{X}(x) dx \]
whenever \(a \leq b\), including the cases \(a=-\infty\) or \(b=\infty\).
Let \(X\) be a random variable with the following p.d.f. \[ f(x)=\{ \begin{array}{cc} \frac{2}{3}x^{-1/3}& { for 0<x<1,}\\ 0& {otherwise}. \end{array} \]
Compute P\((X\leq 8/27)\).
\[ \int_{0}^{8/27} \frac{2}{3}x^{-1/3}dx = x^{2/3} \Biggr|_{0}^{8/27} = \frac{4}{9} \]
<- function(y) { 2/3*y^(-1/3)}
integrand integrate(integrand,lower= 0 ,upper= 8/27)
## 0.4444444 with absolute error < 6.7e-16
4/9 #confirm
## [1] 0.4444444
Do both by hand, and using R. Don’t forget to write your code down in these notes.
\[ P(0 \leq Y\leq\frac{1}{2}) = \int_{0}^{1/2} 4y^{3}dy = \\ y^{4} \Biggr|_{0}^{1/2} = \frac{1}{16} \]
\[ \begin{align} \int_{3/4}^{1} \Bigr(\frac{2}{3}+\frac{2}{3}y \Bigl) dy & = \frac{2}{3}y+\frac{1}{3}y^{2} \Biggr|_{3/4}^{1} \\ & = \Bigr(\frac{2}{3}+\frac{1}{3}\Bigl) - \Bigr(\frac{2}{3}*\frac{3}{4}+\frac{1}{3}*\Bigr(\frac{3}{4}\Bigl)^{2} \Bigl) \\ & = 1 - \Bigr(\frac{1}{2} + \frac{3}{16} \Bigl) \\ & = \frac{5}{16} \end{align} \]
The cumulative distribution function (cdf) associated with \(X\) (either discrete or continuous) is the function \(F(x)=P(X\leq x)\), or written out in terms of the pdf’s and cdf’s.
\[ F(x)=P(X\leq x)=\int_{-\infty}^{x}f(t)dt \]
for continuous variables and \[ F(x)=P(X\leq x)=\sum_{n=-\infty}^{x}p(n) \] for discrete variables.
Let \(X\) be a continuous random variable with pdf \(f\) and cdf \(F\).
Find the cdf for the random variable \(Y\) for the following pdf: \[ f_{Y}(y)=4y^{3} \]
for \(0\leq y\leq 1\). Calculate \(P(0\leq Y \leq 1/2)\) using \(F_{Y}(y)\).
\[F(y)=P(Y\leq y)=\int_{0}^{y}4t^{3}dt=y^4\] \[P(Y\leq 0.5)=F\left(\frac{1}{2}\right)=\left(\frac{1}{2}\right)^{4}=\frac{1}{16}\]
A random variable \(Y\) has CDF as follows:
\[ F(y)=\{ \begin{array}{cc} 0& for y<0\\ ln(y)&1\leq y\leq e\\ 1&e<y\\ \end{array} \]
\[ln(2)\]
log(2)
## [1] 0.6931472
\[ ln(2.5) - ln(2)\]
log(2.5)-log(2)
## [1] 0.2231436
Same as b)!
\(f(y)=\frac{d}{dy} F(y)=\frac{1}{y}\)
\[ F(y)= \Bigg\{ \begin{array}{cc} 0 & \mbox{for } y<0\\ 4y^{3}-3y^{4} & 0\leq y\leq 1\\ 1 & y > 1 \end{array} \] Find \(P(\frac{1}{4}<Y<\frac{3}{4})\).
I’ll solve this by defining function in R, and using it to calculate the definite integrals.
<- function(y){4*y^3-3*y^4}
Fy Fy(.75) - Fy(.25)
## [1] 0.6875
\(\frac{d}{dy}F(y)=\frac{1}{12}\left(3y^{2}+2y\right)\)
\[F(y) = P(Y\leq y) = \int_{0}^{y}te^{-t}dt\] Integrate by parts where \(u=t, du=dt, dv = e^{-t}dt, v = -e^{-t}\)
\[ -e^{-t}t + \int_{0}^{y}e^{-t}dt = -e^{-t}t - e^{-t}\Biggr|_{0}^{y} = 1 - e^{-y}(y+1) \]
So \(F(y) = 1 - e^{-y}(y+1)\)