Good Review Materials: - Samples From A Random Variable Are Real Numbers
Good Review Materials: - Samples From A Random Variable Are Real Numbers
http://www.imageprocessingbook.com/DIP2E/dip2e_downloads/review_material_downloads.htm
Tim Marks, Cognitive Science Department Tim Marks, Cognitive Science Department
Tim Marks, Cognitive Science Department Tim Marks, Cognitive Science Department
1
Continuous random variables Random variables
What is the total area under any pdf ? How much change do you have on you?
Asking a person (chosen at random) that question can
p( x)dx = 1?
be thought of as sampling from a random variable.
h h h
Tim Marks, Cognitive Science Department Tim Marks, Cognitive Science Department
Variance E ((X ) 2 ) (a )
i
2
P(ai ) (x ) 2
p(x) dx
Var(X) i
Tim Marks, Cognitive Science Department Tim Marks, Cognitive Science Department
Tim Marks, Cognitive Science Department Tim Marks, Cognitive Science Department
2
Finding mean, variance in Matlab Example continuous random variable
Samples x = [x1 x 2 x 3 L x n ] Peoples heights (made up)
Mean Gaussian
>> m = (1/n)*sum(x)
= 67 , 2 = 20
Variance x1 m
What if you went
1 x m to a planet where
= [x1 m
2
x 2 m L x n m] 2
n M heights Gaussian
x n m = 75 , 2 = 5
Method 1: >> v = (1/n)*(x-m)*(x-m) How would they be
Method 2: >> z = x-m different from us?
>> v = (1/n)*z*z
Tim Marks, Cognitive Science Department Tim Marks, Cognitive Science Department
1 x m x
n n
1
Mean m=
n i=1
v i = i =
n i=1 y i m y
What is mean of V ?
Mean of X is 67 67 To estimate mean of V in Matlab
m =
Mean of Y is 10 10 >> (1/n)*sum(v,2)
Tim Marks, Cognitive Science Department Tim Marks, Cognitive Science Department
3
Random vector Covariance of two random variables
Example 2-D random vector:
X where X is random variable of human heights Height and wake-up time are uncorrelated, but
V = height and weight are correlated.
Y Y is random variable of human weights
Sample n times from V v1 v 2 L v n Covariance
What will graph x1 x 2 L x n Cov(X, Y) = 0 for X = height, Y = wake-up times
look like? y1 y 2 L y n Cov(X, Y) > 0 for X = height, Y = weight
Definition:
Cov(X,Y ) = E ((X x )(Y y ))
Covariance matrix of a
Example covariance matrix
D-dimensional random vector
In 2 dimensions Peoples heights
X (made up)
V = X ~ N(67, 20)
Y
(
Cov(V) = E (V )(V )
T
) Time people woke up
this morning
X X Var(X ) Cov(X,Y ) Y ~ N(9, 1)
= E [X X Y Y ] =
Y Y Cov(X,Y ) Var(Y)
In D dimensions
Cov(V) = E ((V )(V ) )
T
What is the covariance
20 0
When is a covariance matrix symmetric? X
matrix of V = ? 0 1
A. always, B. sometimes, or C. never Y
Tim Marks, Cognitive Science Department Tim Marks, Cognitive Science Department
4
Estimating the covariance matrix from
Gaussian distribution in D dimensions
samples (including Matlab code)
Sample n times and find mean of samples 1-dimensional Gaussian is completely determined
v1 v 2 L v n
mx
by its mean, , and variance, 2 :
x x2 L xn (x )2
V = 1 m= 1
y1 y2 L yn my X ~ N(, 2) p(x) =
2 e 2 2
>> m = (1/n)*sum(v,2)
X ~ N(, ) p(x) =
(2 ) D/2
1/ 2 e
>> z = v - repmat(m,1,n)
>> v = (1/n)*z*z What happens when D = 1 in the Gaussian formula?
Tim Marks, Cognitive Science Department Tim Marks, Cognitive Science Department