# 0.9 Lab 7a - discrete-time random processes (part 1)  (Page 5/5)

 Page 5 / 5

Notice that we cannot form a density estimate by simply differentiating the empirical CDF, since this function contains discontinuities at thesample locations ${X}_{i}$ . Rather, we need to estimate the probability that a random variable willfall within a particular interval of the real axis. In this section, we will describe a common method known as the histogram .

## The histogram

Our goal is to estimate an arbitrary probability density function, ${f}_{X}\left(x\right)$ , within a finite region of the $x$ -axis. We will do this by partitioning the region into $L$ equally spaced subintervals, or “bins”,and forming an approximation for ${f}_{X}\left(x\right)$ within each bin. Let our region of support start at the value ${x}_{0}$ , and end at ${x}_{L}$ . Our $L$ subintervals of this region will be $\left[{x}_{0},{x}_{1}\right]$ , $\left({x}_{1},{x}_{2}\right]$ , ..., $\left({x}_{L-1},{x}_{L}\right]$ . To simplify our notation we will define $bin\left(k\right)$ to represent the interval $\left({x}_{k-1},{x}_{k}\right]$ , $k=1,2,\cdots ,L$ , and define the quantity $\Delta$ to be the length of each subinterval.

$\begin{array}{ccc}\hfill bin\left(k\right)& =& \left({x}_{k-1},{x}_{k}\right]\phantom{\rule{0.277778em}{0ex}}\phantom{\rule{0.277778em}{0ex}}\phantom{\rule{0.277778em}{0ex}}k=1,2,\cdots ,L\hfill \\ \hfill \Delta & =& \frac{{x}_{L}-{x}_{0}}{L}\hfill \end{array}$

We will also define $\stackrel{˜}{f}\left(k\right)$ to be the probability that $X$ falls into $bin\left(k\right)$ .

$\begin{array}{ccc}\hfill \stackrel{˜}{f}\left(k\right)& =& P\left(X\in bin\left(k\right)\right)\hfill \\ & =& {\int }_{{x}_{k-1}}^{{x}_{k}}{f}_{X}\left(x\right)dx\hfill \end{array}$
$\begin{array}{ccc}& \approx & {f}_{X}\left(x\right)\Delta \phantom{\rule{4pt}{0ex}}\phantom{\rule{4.pt}{0ex}}\text{for}\phantom{\rule{4.pt}{0ex}}x\in bin\left(k\right)\hfill \end{array}$

The approximation in [link] only holds for an appropriately small bin width $\Delta$ .

Next we introduce the concept of a histogram of a collection of i.i.d. random variables $\left\{{X}_{1},{X}_{2},\cdots ,{X}_{N}\right\}$ . Let us start by defining a function that will indicate whether ornot the random variable ${X}_{n}$ falls within $bin\left(k\right)$ .

${I}_{n}\left(k\right)=\left\{\begin{array}{cc}1,\hfill & \text{if}\phantom{\rule{4.pt}{0ex}}{X}_{n}\in bin\left(k\right)\hfill \\ 0,\hfill & \text{if}\phantom{\rule{4.pt}{0ex}}{X}_{n}\notin bin\left(k\right)\hfill \end{array}\right)$

The histogram of ${X}_{n}$ at $bin\left(k\right)$ , denoted as $H\left(k\right)$ , is simply the number of random variables that fall within $bin\left(k\right)$ . This can be written as

$H\left(k\right)=\sum _{n=1}^{N}{I}_{n}\left(k\right)\phantom{\rule{4pt}{0ex}}.$

We can show that the normalized histogram, $H\left(k\right)/N$ , is an unbiased estimate of the probability of $X$ falling in $bin\left(k\right)$ . Let us compute the expected value of the normalized histogram.

$\begin{array}{ccc}\hfill E\left[\frac{H\left(k\right)}{N}\right]& =& \frac{1}{N}\sum _{n=1}^{N}E\left[{I}_{n}\left(k\right)\right]\hfill \\ & =& \frac{1}{N}\sum _{n=1}^{N}\left\{1·P\left({X}_{n}\in bin\left(k\right)\right)+0·P\left({X}_{n}\notin bin\left(k\right)\right)\right\}\hfill \\ & =& \stackrel{˜}{f}\left(k\right)\hfill \end{array}$

The last equality results from the definition of $\stackrel{˜}{f}\left(k\right)$ , and from the assumption that the ${X}_{n}$ 's have the same distribution. A similar argument may be used to show that the variance of $H\left(k\right)$ is given by

$\begin{array}{c}\hfill Var\left[\frac{H\left(k\right)}{N}\right]=\frac{1}{N}\stackrel{˜}{f}\left(k\right)\left(1-\stackrel{˜}{f}\left(k\right)\right)\phantom{\rule{4pt}{0ex}}.\end{array}$

Therefore, as $N$ grows large, the bin probabilities $\stackrel{˜}{f}\left(k\right)$ can be approximated by the normalized histogram $H\left(k\right)/N$ .

$\stackrel{˜}{f}\left(k\right)\approx \frac{H\left(k\right)}{N}$

Using [link] , we may then approximate the density function ${f}_{X}\left(x\right)$ within $bin\left(k\right)$ by

${f}_{X}\left(x\right)\approx \frac{H\left(k\right)}{N\Delta }\phantom{\rule{4pt}{0ex}}\phantom{\rule{4pt}{0ex}}\phantom{\rule{4.pt}{0ex}}\text{for}\phantom{\rule{4.pt}{0ex}}x\in bin\left(k\right)\phantom{\rule{4pt}{0ex}}.$

Notice this estimate is a staircase function of $x$ which is constant over each interval $bin\left(k\right)$ . It can also easily be verified that this density estimate integrates to 1.

## Exercise

Let $U$ be a uniformly distributed random variable on the interval [0,1]with the following cumulative probability distribution, ${F}_{U}\left(u\right)$ :

${F}_{U}\left(u\right)=\left\{\begin{array}{cc}0,\hfill & \text{if}\phantom{\rule{4.pt}{0ex}}u<0\hfill \\ u,\hfill & \text{if}\phantom{\rule{4.pt}{0ex}}0\le u\le 1\hfill \\ 1,\hfill & \text{if}\phantom{\rule{4.pt}{0ex}}u>1\hfill \end{array}\right)$

We can calculate the cumulative probability distribution for the new random variable $X={U}^{\frac{1}{3}}$ .

$\begin{array}{ccc}\hfill {F}_{X}\left(x\right)& =& P\left(X\le x\right)\hfill \\ & =& P\left({U}^{\frac{1}{3}}\le x\right)\hfill \\ & =& P\left(U\le {x}^{3}\right)\hfill \\ & =& {\left({F}_{U},\left(u\right)|}_{u={x}^{3}}\hfill \\ & =& \left\{\begin{array}{cc}0,\hfill & \text{if}\phantom{\rule{4.pt}{0ex}}x<0\hfill \\ {x}^{3},\hfill & \text{if}\phantom{\rule{4.pt}{0ex}}0\le x\le 1\hfill \\ 1,\hfill & \text{if}\phantom{\rule{4.pt}{0ex}}x>1\hfill \end{array}\right)\hfill \end{array}$

Plot ${F}_{X}\left(x\right)$ for $x\in \left[0,1\right]$ . Also, analytically calculate the probability density ${f}_{X}\left(x\right)$ , and plot it for $x\in \left[0,1\right]$ .

Using $L=20$ , ${x}_{0}=0$ and ${x}_{L}=1$ , use Matlab to compute $\stackrel{˜}{f}\left(k\right)$ , the probability of $X$ falling into $bin\left(k\right)$ .

Use the fact that $\stackrel{˜}{f}\left(k\right)={F}_{X}\left({x}_{k}\right)-{F}_{X}\left({x}_{k-1}\right)$ .
Plot $\stackrel{˜}{f}\left(k\right)$ for $k=1,\cdots ,L$ using the stem function.

## Inlab report

1. Submit your plots of ${F}_{X}\left(x\right)$ , ${f}_{X}\left(x\right)$ and $\stackrel{˜}{f}\left(k\right)$ . Use stem to plot $\stackrel{˜}{f}\left(k\right)$ , and put all three plots on a single figure using subplot .
2. Show (mathematically) how ${f}_{X}\left(x\right)$ and $\stackrel{˜}{f}\left(k\right)$ are related.

Generate 1000 samples of a random variable $U$ that is uniformly distributed between 0 and 1 (using the rand command). Then form the random vector $X$ by computing $X={U}^{\frac{1}{3}}$ .

Use the Matlab function hist to plot a normalized histogram for your samples of $X$ , using 20 bins uniformly spaced on the interval $\left[0,1\right]$ .

Use the Matlab command H=hist(X,(0.5:19.5)/20) to obtain the histogram, and then normalize H .
Use the stem command to plot the normalized histogram $H\left(k\right)/N$ and $\stackrel{˜}{f}\left(k\right)$ together on the same figure using subplot .

## Inlab report

1. Submit your two stem plots of $H\left(k\right)/N$ and $\stackrel{˜}{f}\left(k\right)$ . How do these plots compare?
2. Discuss the tradeoffs (advantages and the disadvantages) between selecting a very large or very small bin-width.

where we get a research paper on Nano chemistry....?
what are the products of Nano chemistry?
There are lots of products of nano chemistry... Like nano coatings.....carbon fiber.. And lots of others..
learn
Even nanotechnology is pretty much all about chemistry... Its the chemistry on quantum or atomic level
learn
da
no nanotechnology is also a part of physics and maths it requires angle formulas and some pressure regarding concepts
Bhagvanji
Preparation and Applications of Nanomaterial for Drug Delivery
revolt
da
Application of nanotechnology in medicine
what is variations in raman spectra for nanomaterials
I only see partial conversation and what's the question here!
what about nanotechnology for water purification
please someone correct me if I'm wrong but I think one can use nanoparticles, specially silver nanoparticles for water treatment.
Damian
yes that's correct
Professor
I think
Professor
Nasa has use it in the 60's, copper as water purification in the moon travel.
Alexandre
nanocopper obvius
Alexandre
what is the stm
is there industrial application of fullrenes. What is the method to prepare fullrene on large scale.?
Rafiq
industrial application...? mmm I think on the medical side as drug carrier, but you should go deeper on your research, I may be wrong
Damian
How we are making nano material?
what is a peer
What is meant by 'nano scale'?
What is STMs full form?
LITNING
scanning tunneling microscope
Sahil
how nano science is used for hydrophobicity
Santosh
Do u think that Graphene and Fullrene fiber can be used to make Air Plane body structure the lightest and strongest. Rafiq
Rafiq
what is differents between GO and RGO?
Mahi
what is simplest way to understand the applications of nano robots used to detect the cancer affected cell of human body.? How this robot is carried to required site of body cell.? what will be the carrier material and how can be detected that correct delivery of drug is done Rafiq
Rafiq
if virus is killing to make ARTIFICIAL DNA OF GRAPHENE FOR KILLED THE VIRUS .THIS IS OUR ASSUMPTION
Anam
analytical skills graphene is prepared to kill any type viruses .
Anam
Any one who tell me about Preparation and application of Nanomaterial for drug Delivery
Hafiz
what is Nano technology ?
write examples of Nano molecule?
Bob
The nanotechnology is as new science, to scale nanometric
brayan
nanotechnology is the study, desing, synthesis, manipulation and application of materials and functional systems through control of matter at nanoscale
Damian
Is there any normative that regulates the use of silver nanoparticles?
what king of growth are you checking .?
Renato
What fields keep nano created devices from performing or assimulating ? Magnetic fields ? Are do they assimilate ?
why we need to study biomolecules, molecular biology in nanotechnology?
?
Kyle
yes I'm doing my masters in nanotechnology, we are being studying all these domains as well..
why?
what school?
Kyle
biomolecules are e building blocks of every organics and inorganic materials.
Joe
Got questions? Join the online conversation and get instant answers!