Download Random Variable - ECSE - Rensselaer Polytechnic Institute

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Basic Ideas in Probability and
Statistics for Experimenters:
Part I: Qualitative Discussion
He uses statistics as a drunken man uses lamp-posts –
for support rather than for illumination … A. Lang
Shivkumar Kalyanaraman
Rensselaer Polytechnic Institute
[email protected]
http://www.ecse.rpi.edu/Homepages/shivkuma
Based in part uponShivkumar
slides of Prof. Raj
Jain (OSU)
Kalyanaraman
Rensselaer Polytechnic Institute
1
Overview
Why Probability and Statistics: The Empirical Design
Method…
 Qualitative understanding of essential probability and
statistics
 Especially the notion of inference and statistical
significance
 Key distributions & why we care about them…
 Reference: Chap 12, 13 (Jain), Chap 2-3
(Box,Hunter,Hunter), and


http://mathworld.wolfram.com/topics/ProbabilityandStatistics.html
Shivkumar Kalyanaraman
Rensselaer Polytechnic Institute
2
Why Care About Prob. & Statistics?
How to make
this empirical
design process
EFFICIENT??
How to avoid
pitfalls in
inference!
Shivkumar Kalyanaraman
Rensselaer Polytechnic Institute
3
Probability
Think of probability as modeling an experiment
 The set of all possible outcomes is the sample
space: S


Classic “Experiment”: Tossing a die: S =
{1,2,3,4,5,6}
 Any subset A of S is an event:
A = {the
outcome is even} = {2,4,6}
Shivkumar Kalyanaraman
Rensselaer Polytechnic Institute
4
Probability of Events: Axioms
•P is the Probability Mass function if it maps
each event A, into a real number P(A), and:
i.)
P( A)  0 for every event A  S
ii.) P(S) = 1
iii.)If A and B are mutually exclusive events then,
P ( A  B )  P ( A)  P (B )
Shivkumar Kalyanaraman
Rensselaer Polytechnic Institute
5
Probability of Events
…In fact for any sequence of pair-wisemutually-exclusive events, we have
A1, A2 , A3 ,...
(i.e. Ai Aj  0 for any i  j )


P   An    P ( An )
 n 1  n 1


Shivkumar Kalyanaraman
Rensselaer Polytechnic Institute
6
Other Properties

P ( A)  1  P ( A)

P ( A)  1

P( A  B )  P ( A)  P(B)  P( AB)

A  B  P ( A)  P (B )
Derived by breaking up above sets into
mutually exclusive pieces and
comparing to fundamental axioms!!
Rensselaer Polytechnic Institute
7
Shivkumar Kalyanaraman
Conditional Probability
• P ( A | B )=
(conditional) probability that the
outcome is in A given that we know the
outcome in B
P ( AB )
P( A | B) 
P (B )
P (B )  0
•Example: Toss one die.
P (i  3 | i is odd)=
•Note that: P ( AB )  P (B )P ( A | B )  P ( A)P (B | A)
Shivkumar Kalyanaraman
Rensselaer Polytechnic Institute
8
Independence



Events A and B are independent if P(AB) = P(A)P(B).
Also: P ( A | B )  P ( A) and P (B | A)  P (B )
Example: A card is selected at random from an
ordinary deck of cards.
 A=event that the card is an ace.
 B=event that the card is a diamond.
P ( AB ) 
P ( A) 
P (B ) 
P ( A)P (B ) 
Shivkumar Kalyanaraman
Rensselaer Polytechnic Institute
9
Random Variable as a Measurement

We cannot give an exact description of a sample
space in these cases, but we can still describe
specific measurements on them
 The
temperature change produced.
 The number of photons emitted in one
millisecond.
 The time of arrival of the packet.
Shivkumar Kalyanaraman
Rensselaer Polytechnic Institute
10
Random Variable as a Measurement

Thus a random variable can be thought of as a
measurement on an experiment
Shivkumar Kalyanaraman
Rensselaer Polytechnic Institute
11
Probability Mass Function for a
Random Variable

The probability mass function (PMF) for a (discrete valued)
random variable X is:
PX ( x )  P( X  x )  P({s  S | X (s)  x})
PX ( x )  0
for
  x  

Note that

Also for a (discrete valued) random variable X

P
x 
X
(x)  1
Shivkumar Kalyanaraman
Rensselaer Polytechnic Institute
12
Probability Distribution Function (pdf)
a.k.a. frequency histogram, p.m.f (for discrete r.v.)
Shivkumar Kalyanaraman
Rensselaer Polytechnic Institute
13
Cumulative Distribution Function

The cumulative distribution function (CDF) for a
random variable X is
FX ( x)  P( X  x)  P({s  S | X (s)  x})

Note that FX ( x ) is non-decreasing in x, i.e.
x1  x2  Fx ( x1 )  Fx ( x2 )

Also
lim Fx ( x)  0
and
x 
lim Fx ( x)  1
x 
Shivkumar Kalyanaraman
Rensselaer Polytechnic Institute
14
PMF and CDF: Example
Shivkumar Kalyanaraman
Rensselaer Polytechnic Institute
15
Expectation of a Random Variable

The expectation (average) of a (discrete-valued) random variable X
is


x 

X  E ( X )   xP( X  x)   xPX ( x)

Three coins example:
1
3
3
1
E ( X )   xPX ( x)  0   1  2   3   1.5
x 0
8
8
8
8
3
Shivkumar Kalyanaraman
Rensselaer Polytechnic Institute
16
Expectation (Mean) = Center of Gravity
Shivkumar Kalyanaraman
Rensselaer Polytechnic Institute
17
Median, Mode

Median = F-1 (0.5), where F = CDF
 Aka 50% percentile element
 I.e. Order the values and pick the middle element
 Used when distribution is skewed

Mode: Most frequent or highest probability value
 Multiple modes are possible
 Need not be the “central” element
 Mode may not exist (eg: uniform distribution)
 Used with categorical variables
Shivkumar Kalyanaraman
Rensselaer Polytechnic Institute
18
Shivkumar Kalyanaraman
Rensselaer Polytechnic Institute
19
Shivkumar Kalyanaraman
Rensselaer Polytechnic Institute
20
Measures of Spread/Dispersion: Why Care?
You can drown in a river of average depth 6 inches!
Shivkumar Kalyanaraman
Rensselaer Polytechnic Institute
21
Standard Deviation, Coeff. Of Variation,
SIQR
Variance: second moment around the mean:
 2 = E((X-)2)
 Standard deviation = 

Coefficient of Variation (C.o.V.)= /
 SIQR= Semi-Inter-Quartile Range (used with
median = 50th percentile)
 (75th percentile – 25th percentile)/2

Shivkumar Kalyanaraman
Rensselaer Polytechnic Institute
22
Covariance and Correlation: Measures of
Dependence

Covariance:



=
For i = j, covariance = variance!
Independence => covariance = 0 (not vice-versa!)
Correlation (coefficient) is a normalized (or scaleless)
form of covariance:

Between –1 and +1.
 Zero => no correlation (uncorrelated).
 Note: uncorrelated DOES NOT mean independent!
Shivkumar Kalyanaraman
Rensselaer Polytechnic Institute
23
Continuous-valued Random
Variables
So far we have focused on discrete(-valued)
random variables, e.g. X(s) must be an integer
 Examples of discrete random variables: number
of arrivals in one second, number of attempts
until success
 A continuous-valued random variable takes on a
range of real values, e.g. X(s) ranges from 0 to
as s varies.
 Examples of continuous(-valued) random
variables: time when a particular arrival occurs,
time between consecutive arrivals.

Shivkumar Kalyanaraman
Rensselaer Polytechnic Institute
24
Continuous-valued Random
Variables

Thus, for a continuous random variable X, we
can define its probability density function (pdf)
dFX ( x)
f x ( x)  F X ( x) 
dx
'

Note that since FX ( x) is non-decreasing in x we
have
f X ( x)  0 for all x.
Shivkumar Kalyanaraman
Rensselaer Polytechnic Institute
25
Properties of Continuous Random
Variables

From the Fundamental Theorem of Calculus, we
x
have
FX ( x) 

In particular,
f x ( x)dx





fx( x)dx  FX ()  1

More generally,

b
a
f X ( x)dx  FX (b)  FX (a)  P(a  X  b)
Shivkumar Kalyanaraman
Rensselaer Polytechnic Institute
26
Expectation of a Continuous
Random Variable

The expectation (average) of a continuous random variable X is
given by

E( X ) 
 xf
X
( x)dx


Note that this is just the continuous equivalent of the discrete
expectation

E ( X )   xPX ( x)
x 
Shivkumar Kalyanaraman
Rensselaer Polytechnic Institute
27
Important (Discrete) Random
Variable: Bernoulli

The simplest possible measurement on an experiment:
 Success (X = 1) or failure (X = 0).

Usual notation:
PX (1)  P( X  1)  p

PX (0)  P( X  0)  1  p
E(X)=
Shivkumar Kalyanaraman
Rensselaer Polytechnic Institute
28
Important (discrete) Random
Variables: Binomial

Let X = the number of success in n independent Bernoulli
experiments ( or trials).
P(X=0) =
P(X=1) =
P(X=2)=
• In general, P(X = x) =
Binomial Variables are useful for proportions (of successes.
Failures) for a small number of repeated experiments. For larger
number (n), under certain conditions (p is small), Poisson
distribution is used.
Shivkumar Kalyanaraman
Rensselaer Polytechnic Institute
29
Binomial can be skewed or normal
Depends upon
p and n !
Shivkumar Kalyanaraman
Rensselaer Polytechnic Institute
30
Important Random Variable:
Poisson

A Poisson random variable X is defined by its PMF:
P( X  x) 

x
x!
Where

Exercise: Show that

 PX ( x)  1
e

x  0,1, 2,...
 > 0 is a constant
and E(X) =
x 0


Poisson random variables are good for counting frequency of
occurrence: like the number of customers that arrive to a bank in one
hour, or the number of packets that arrive to a router in one second.
Shivkumar Kalyanaraman
Rensselaer Polytechnic Institute
31
Important Continuous Random
Variable: Exponential
Used to represent time, e.g. until the next arrival
 Has PDF
 e  x
for x  0
X
0
for x < 0

f ( x)  {
for some  > 0
 Properties:


f X ( x)dx  1 and E ( X ) 
0
 Need
1

to use integration by Parts!
Shivkumar Kalyanaraman
Rensselaer Polytechnic Institute
32
Memoryless Property of the
Exponential


An exponential random variable X has the property
that “the future is independent of the part”, i.e. the
fact that it hasn’t happened yet, tells us nothing about
how much longer it will take.
In math terms
e
s
P( X  s  t | X  t )  P( X  s )
for s, t  0
Shivkumar Kalyanaraman
Rensselaer Polytechnic Institute
33
Important Random Variables: Normal
Shivkumar Kalyanaraman
Rensselaer Polytechnic Institute
34
Normal Distribution: PDF & CDF
z

PDF:
With the transformation:
(a.k.a. unit normal deviate)
 z-normal-PDF:

Shivkumar Kalyanaraman
Rensselaer Polytechnic Institute
35
Why is Gaussian Important?
Uniform distribution
looks nothing like
bell shaped (gaussian)!
Large spread ()!
CENTRAL LIMIT TENDENCY!
Sample mean of uniform distribution
(a.k.a sampling distribution), after
very few samples looks remarkably
gaussian, with decreasing  !
Shivkumar Kalyanaraman
Rensselaer Polytechnic Institute
36
Other interesting facts about Gaussian

Uncorrelated r.vs. + gaussian => INDEPENDENT!
 Important in random processes (I.e. sequences
of random variables)

Random variables that are independent, and have
exactly the same distribution are called IID
(independent & identically distributed)

IID and normal with zero mean and variance 2
=> IIDN(0, 2 )
Shivkumar Kalyanaraman
Rensselaer Polytechnic Institute
37
Height & Spread of Gaussian Can
Vary!
Shivkumar Kalyanaraman
Rensselaer Polytechnic Institute
38
Rapidly Dropping Tail Probability!
Sample mean is a gaussian r.v., with x =  & s = /(n)0.5
With larger number of samples, avg of sample means
is an excellent estimate of true mean.
If (original)  is known, invalid mean estimates can
Shivkumar Kalyanaraman
be rejected
with HIGH confidence!
Rensselaer
Polytechnic Institute
39
Confidence Interval

Probability that a measurement will fall within a
closed interval [a,b]: (mathworld definition…)
= (1-)

Jain: the interval [a,b] = “confidence interval”;
the probability level, 100(1-)= “confidence level”;
  = “significance level”


Sampling distribution for means leads to high confidence
levels, I.e. small confidence intervals
Shivkumar Kalyanaraman
Rensselaer Polytechnic Institute
40
Meaning of Confidence Interval
Shivkumar Kalyanaraman
Rensselaer Polytechnic Institute
41
Statistical Inference: Is A = B ?
• Note: sample mean yA is not A, but its
estimate!
• Is this difference statistically
significant?
• Is the null hypothesis yA = yB false ?
Shivkumar Kalyanaraman
Rensselaer Polytechnic Institute
42
Step 1: Plot the samples
Shivkumar Kalyanaraman
Rensselaer Polytechnic Institute
43
Compare to (external) reference
distribution (if available)
Since 1.30 is at the tail of the reference distribution,
the difference between means is NOT statistically significant!
Shivkumar Kalyanaraman
Rensselaer Polytechnic Institute
44
Random Sampling Assumption!
Under random sampling assumption, and the null hypothesis
of yA = yB, we can view the 20 samples from a common population
& construct a reference distributions from the samples itself !
Shivkumar Kalyanaraman
Rensselaer Polytechnic Institute
45
t-distribution: Create a Reference
Distribution from the Samples Itself!
Shivkumar Kalyanaraman
Rensselaer Polytechnic Institute
46
t-distribution
Shivkumar Kalyanaraman
Rensselaer Polytechnic Institute
47
Statistical Significance with Various
Inference Techniques
Normal population
assumption not required
t-distribution
an approx.
for gaussian!
Random sampling
assumption required
Std.dev. estimated
from samples itself!
Shivkumar Kalyanaraman
Rensselaer Polytechnic Institute
48
Normal, 2 & t-distributions: Useful for
Statistical Inference
Shivkumar Kalyanaraman
Rensselaer Polytechnic Institute
49
Relationship between Confidence
Intervals and Comparisons of Means
Shivkumar Kalyanaraman
Rensselaer Polytechnic Institute
50
Related documents