16.322 Stochastic Estimation and Control, Fall 2004 Prof vander velde Lecture 5 Last time Characterizing groups of random variables Names for groups of random variables S=∑X s2=∑∑xX Characterize by pairs to compute E[x]=X=「d观(xy which we define as the correlation Often we do not know the complete distribution, but only simple statistics The most common of the moments of higher ordered distribution functions is the Covariance, Hn=E(X-X)(Y-)=(x-X)( XY-Xy+ Xy XY-X (correlation)-(product of means) Even more significant is the normalized covariance, or correlation coefficient: 1≤p≤1 o201o This correlation coefficient may be thought of as measuring the degree of linear dependence between the random variables: P=0 if the two are independent and p=+l if one is a linear function of the other. First note p=0 if X and Y are ndependent Calculate p for Y=a+bX If linearly related
16.322 Stochastic Estimation and Control, Fall 2004 Prof. Vander Velde Lecture 5 Last time: Characterizing groups of random variables Names for groups of random variables n S = ∑Xi i=1 n n 2 S = ∑∑X iX j i=1 j=1 Characterize by pairs to compute ∞ ∞ E XY ] = XY = dx xyf xy [ ( , ) x y dy ∫ ∫ , −∞ −∞ which we define as the correlation. Often we do not know the complete distribution, but only simple statistics. The most common of the moments of higher ordered distribution functions is the covariance, ⎣ )( ⎦ µ )( xy = E ⎡( X − XY −Y )⎤ = ( X − XY −Y ) = XY − XY − XY + XY = XY − XY − XY + XY = XY − XY = (correlation) − (product of means) Even more significant is the normalized covariance, or correlation coefficient: µxy ρ = µ 2 xy 2 = σ σ , −1 ≤ ρ ≤ 1 σ σ x y x y This correlation coefficient may be thought of as measuring the degree of linear dependence between the random variables: ρ = 0 if the two are independent and ρ = ±1 if one is a linear function of the other. First note ρ = 0 if X and Y are independent. Calculate ρ for Y a = + bX . xy If linearly related: Page 1 of 9
16.322 Stochastic Estimation and Control, Fall 2004 Prof vander velde Y=a+bX YY=aX+br2 y2=a2+abx +b2X aX+bx2-X(a+bX (a2+2abX+62X-a2-2abX-b2r) bIX-X 6(x-x Degree of linear Dependence At every observation, or trial or the experiment, we observe a pair x, y. We ask how well can we approximate y as a linear function of X? =a+bX Choose a and b to minimize the mean squared error, &, in the approximation. Y=a+bX-y 22=a2tb2x2+y2+2abX-2bXY-2ay a2+62x2+2+2abx-2bXY-2ay Page 2 of 9
x 2 16.322 Stochastic Estimation and Control, Fall 2004 Prof. Vander Velde Y = + a bX XY = a X + b X 2 Y 2 2 2 = a + 2abX + b X 2 aX + b X 2 − X (a + bX ) ρ = 2 2 2 2 2 2 2 σ (a + 2abX + b X − a − 2abX − b X ) bX 2 − X 2 ) 2 = ( = bσ x = ±1 sgn( = b) 2 22 ( σ bX 2 − X bσ x 2 x ) Degree of Linear Dependence At every observation, or trial or the experiment, we observe a pair x,y. We ask: how well can we approximate Y as a linear function of X? Y = + a bX approx . 2 Choose a and b to minimize the mean squared error, ε , in the approximation. ε = Y approx . −Y = + a bX −Y 2 2 2 2 ε = a + b X + Y + 2abX − 2bXY − 2aY 2 2 Y 2 = a + b X 2 + + 2abX − 2b XY − 2aY Page 2 of 9
16.322 Stochastic Estimation and Control, Fall 2004 Prof vander velde 2bF-2F=0 05=2bX2+2aX-2xY=0 -X6-=(2bX2-2XY)-(2bx2-2xy)=0 ab b XY A O Y-X=Y Y-X approx X-X y+ E=0 E2=a(a+2b-2)+b2x2+Y2-2bX (-X-x+2x-2) XI x =a1(1-p2)
16.322 Stochastic Estimation and Control, Fall 2004 Prof. Vander Velde 2 ∂ε = 2a + 2bX − 2Y = 0 ∂a 2 ∂ε 2 = 2bX + 2aX − 2XY = 0 ∂b 2 2 ∂ε 2 − X ∂ε = (2b X 2 − 2XY ) − (2bX − 2XY ) = 0 ∂b ∂a b = XY − XY µxy σ y = = ρ 2 X − X 2 σ x 2 σ x aY µxy σ y = − Y 2 X = − ρ X σ x σ x Y = − µxy X + µxy approx . Y X σ2 2 x σ x Y µxy = + 2 ( X − X ) σ x y = + Y ρ σ ( X − X ) σ x y Y Y σ ε = Y approx . −=+ ρ ( X − X ) −Y σ x ε = 0 2 ( 2 2 2 ε = aa + 2bX − 2Y ) + b X +Y − 2b XY (Y Y 2 µxy = − µxy X )(Y − µxy X + 2 µxy X − 2Y ) + µxy X 2 + − 2 XY 2 2 2 2 2 σ σ σ x x x σ x σ x Y 2 µxy µxy 2 µxy 2 2 = − + 2 XY + µxy XY − 2 X + X + − 2 µxy XY 2 2 Y 2 σ σ σ σ x x x x σ x 2 = σ − 2 µxy µxy + µxy 2 σ2 y 2 4 x σ σ x x 2 ⎞ 2 2 = σ − µxy 2 = σ y ⎜ ⎛ 1− µxy 2 y ⎟ 2 σ ⎜ x ⎝ σ xσ y 2 ⎠ ⎟ 2 (1− 2 = σ ρ ) y Page 3 of 9
16.322 Stochastic Estimation and Control, Fall 2004 Prof vander velde If X and y were actually linearly If X and y were independent, the related, the points would appear on points would scatter all over the x,y one straight line, p would be tl, and plane, u would be zero, so the mean squared error in the =Y, and a2 approximation would be zero Note that dependence other than linear is not necessarily measured by p Example: y=X and X=X=0 u=Y=Y=X3-X2=0 >P=0, but X, Y are dependent Also, high correlation does not imply cause and effect Example: Dying in the hospital A survey reports that two events, "entering the hospital" and "dying within 1 week"have a high correlation. This relationship, however, is not causal. There exists a third, unreported event, " disease, which causes each of the other events Page 4 of 9
16.322 Stochastic Estimation and Control, Fall 2004 Prof. Vander Velde If X and Y were actually linearly If X and Y were independent, the related, the points would appear on points would scatter all over the x,y one straight line, ρ would be ±1 , and plane, µxy would be zero, so the mean squared error in the Y = Y , and ε 2 = σ y 2 . approx . approximation would be zero. Note that dependence other than linear is not necessarily measured by ρ. 2 3 Example: Y = X and X = X = 0 . 2 µxy = XY = XY = X 3 − X X = 0 → = ρ 0, but XY , are dependent! Also, high correlation does not imply cause and effect. Example: Dying in the hospital. A survey reports that two events, “entering the hospital” and “dying within 1 week” have a high correlation. This relationship, however, is not causal. There exists a third, unreported event, “disease,” which causes each of the other events. Page 4 of 9
16.322 Stochastic Estimation and Control, Fall 2004 Prof vander velde Vector-Matrix notation Define the vectors X and x and the mean Elr E[]=「∫(x) x1…dxn:J(x) Correlation matrix ELXX'=Xr=M M=XX o the correlation matrix arrays all the correlations among the X, with the mean squared values on the diagonal Note that. The correlation matrix is symmetric If X; and X; are independent, the correlation is the product of the means (from the product rule for the pdf) XX=XX Covariance matrix [(r-XXX-x)]=ELXXJ-E[X]X-XELr]+X E[ XX-XX XX-XX=C C,=[(X-X)(X-X) XX-XX This is by definition the covariance between Xi and X. So the covariance matrix arrays all the covariances among the X, with the variances along the diagonal. Page 5 of 9
16.322 Stochastic Estimation and Control, Fall 2004 Prof. Vander Velde Vector-Matrix Notation Define the vectors X and x and the mean E[X ] . ∞ ∞ E X dx1... dx xf ( x) [ ] = ∫ ∫ n n −∞ −∞ ⎡ ⎤ ∞ ∞ x1 dx1... dx ⎢ ⎥ M f ( x) = ∫ ∫ n n ⎢ ⎥ −∞ −∞ ⎢ ⎥ x⎣ ⎦n = X ⎡ X ⎤1 ⎢ ⎥ = M ⎢ ⎥ ⎢X ⎥ ⎣ n ⎦ Correlation Matrix T E ⎡XX T ⎤ ⎦ ⎣ = XX = M M ij = X Xi j So the correlation matrix arrays all the correlations among the Xi with the mean squared values on the diagonal. Note that: • The correlation matrix is symmetric. • If Xi and Xj are independent, the correlation is the product of the means (from the product rule for the pdf). XiX j = X Xi j Covariance Matrix T T T T T E ⎡( X − X )( X − X ) ⎤ = E ⎡XX ⎤ − E X ] X − XE ⎡X ⎤ + XX ⎣ ⎦ ⎣ ⎦ [ ⎣ ⎦ T T = E ⎡XX T ⎤ ⎦ − XX − XX T + XX ⎣ T = XX T − XX ≡ C T Cij = ⎡( X − X )( X − X ) ⎤ ⎣ ⎦ij = X Xi j − X Xi j This is by definition the covariance between Xi and Xj. So the covariance matrix arrays all the covariances among the Xi with the variances along the diagonal. Page 5 of 9
16.322 Stochastic Estimation and Control, Fall 2004 Prof vander velde If Xi and X are independent, their covariance is zero If the covariance between two variables is zero, they are said to be uncorrelated This does not, in general, imply that they are independent Conditional distribution Sometimes the notion of a conditional distribution is important. If we wish to confine our attention to the subject of cases in which an event e occurs, we would define the conditional probability distribution function FE(x)=f(x E)=P(X0 these events are mutually exclusive and collectively exhaustive. lim f(x E)dx f(dxp(ex) f(uP(eju)du f(xP(Elx) f(uP(eJudu
16.322 Stochastic Estimation and Control, Fall 2004 Prof. Vander Velde If Xi and Xj are independent, their covariance is zero. If the covariance between two variables is zero, they are said to be uncorrelated. This does not, in general, imply that they are independent. Conditional Distribution Sometimes the notion of a conditional distribution is important. If we wish to confine our attention to the subject of cases in which an event E occurs, we would define the conditional probability distribution function: Fx ( ) = F x E ( | ( | ) = PX ≤ x E ) E P X( , ≤ xE ) = PE ( ) and the conditional probability density function: dF x E ( ) = f x E ) = ( ) fx ( | E dx Application of Bayes’ Rule Bayes’ theorem can be written for the distribution of a random variable conditioned on the occurrence of an event E or the observation of a certain value of another random variable. Conditioned on an event E: ( | ( )( | Original form: k k P A E ) = P A P E A ) k ∑P A P E A ( ) ( | ) i i i Let the events A x i → the events x < X ≤ + dx Note that for different values x as dx → 0 these events are mutually exclusive and collectively exhaustive. ( | ) () ( | lim f x E dx = ∞ f x dxP E x ) dx→0 f ( ) ( | ) u P E u du ∫ −∞ (| ()( | f x E ) = f x P E x ) ∞ f ( ) ( | ) u P E u du ∫ −∞ Page 6 of 9
16.322 Stochastic Estimation and Control, Fall 2004 Prof. VanderⅤelde Example: Measuring the position of a spacecraft far away Measurement: y=x+n, where n is noise. E implies y lies in a quantized interval. It is simple to use this interval to estimate y, but not correct y1<y≤y2 y<x+n≤y2 nsa Area=P(E y1 y2x We update the unconditional distribution for x to the conditional distribution for x. This is the right way
16.322 Stochastic Estimation and Control, Fall 2004 Prof. Vander Velde Example: Measuring the position of a spacecraft far away Measurement: y xn = + , where n is noise. E implies y lies in a quantized interval. It is simple to use this interval to estimate y, but not correct. E ⇒ y y y 1 < ≤ 2 y x n y 1 <+≤ 2 y x n y x 1 −<≤ 2 − We update the unconditional distribution for x to the conditional distribution for x. This is the right way. Page 7 of 9
16. 322 Stochastic Estimation and Control, Fall 2004 Prof vander velde Conditioned on a value ofy: Let the event E be the event y<r sy+dy. E will be the value taken by y(like a measurement variable) lim f(x y)= f(x)f(ylx)dy f(u)f(yjudydu Note: y is not the variable of integration. f(xly= /(x)(y Ix) f(u)f(y judu This pre ovides a basis for the estimation of a parameter X based on prior information, f(x), and measurements y which are related to X. Example: y=x+nn=y-x parameterizing x f(yx)=f(y-x) We assume n is independent of x. f(ylx)is the noise distribution shifted by x f(n) fy×)=-fn(yx) Conditional Expectation The conditional expectation of a random variable or function of a random variable is the expectation calculated with the conditional distribution. E[g(x)1a= g(x)f(x[A)dx a useful relation involving conditional expectations E[8(x)=∑P(A4E[8(X)|4 if the Ai are mutually exclusive and exhaustive. Or if we let the events A, be the events y<Y≤y+dy
16.322 Stochastic Estimation and Control, Fall 2004 Prof. Vander Velde Conditioned on a value of Y: Let the event E be the event y Y y dy < ≤ + . E will be the value taken by y (like a measurement variable). ( | () ( | lim fxy ) = f xfyx)dy dy→0 ∞ f ( ) ( | u f y u)dydu ∫ −∞ Note: y is not the variable of integration. ( | () ( | fxy ) = fxfyx ) ∞ f ( ) ( | uf yu)du ∫ −∞ This provides a basis for the estimation of a parameter X based on prior information, f(x), and measurements y which are related to X. Example: y x n n y x = + = − parameterizing x f (| ( y x) = f y x − ) n We assume n is independent of x. f ( | y x)is the noise distribution shifted by x. Conditional Expectation The conditional expectation of a random variable or function of a random variable is the expectation calculated with the conditional distribution. ∞ E g x A [ ( )| ( ) ( | ) ] = g x f x A dx ∫ −∞ A useful relation involving conditional expectations is Egx [ ( )] = ∑PA E g X A ( ) i [ ( ) | i] i if the Ai are mutually exclusive and exhaustive. Or, if we let the events Ai be the events y Y y d <≤+ y , Page 8 of 9
16.322 Stochastic Estimation and Control, Fall 2004 Prof vander velde E[8(x]=E[g(x)ly]/(y)dy The conditional expectation of a random variable, Exlyl, is often taken as the estimate of the random variable after incorporating the effect of a measured event or related random variable f(x EI,En): State of knowledge about x given observations El,En f(xiyi,,y,n): State of knowledge about x given measurements y,,,'n Probability Distribution of Functions of Random variables The probability distribution and density for functions of random variables can be calculated from the distributions of the variables themselves Z In general, if Z=g(X, y) and we want f(=),we can use F(二)=P(z≤=) =P[g(X,)≤ =」d,(xy to get the distribution function for all values of (x)=F(=) In particular cases, there may be easier ways to do this, but this is the general ocedure Page 9 of 9
16.322 Stochastic Estimation and Control, Fall 2004 Prof. Vander Velde ∞ Egx [ ( )] = Egx [ ( ) | y f y dy ] ( ) ∫ −∞ The conditional expectation of a random variable, E[x y| ], is often taken as the estimate of the random variable after incorporating the effect of a measured event or related random variable. f (x E| 1 ,...,En ) : State of knowledge about x given observations E1,…,En f (x y| 1 ,..., yn ) : State of knowledge about x given measurements y1,…,yn Probability Distribution of Functions of Random Variables The probability distribution and density for functions of random variables can be calculated from the distributions of the variables themselves. In general, if Z = gXY (, ) and we want f ( )z , we can use z Fz ( ) = PZ ( ≤ z) z = PgXY [ ( , ) ≤ z] dx dy f x y = ( , x y ) ∫ ∫ , to get the distribution function for all values of z. dF z z f z( ) = () z dz In particular cases, there may be easier ways to do this, but this is the general procedure. Page 9 of 9