Sunday, August 19, 2012

Law of Iterative Expectations/Law of Total Expectations


* The law of iterative expectations (LIE) is an extremely useful rule that can be frequently and usefully employed in many econometric proofs.

* This post will explore some simulated results in an attempt to strengthen our intution.

* LIE is the statement E(Y)=E(E(Y|X))

* For a proof using sums (http://en.wikipedia.org/wiki/Law_of_total_expectation)

* A proof using pdf probability rules can be found at (http://econ.wikidot.com/conditionaldistributions)

* Example 1: OLS

* In OLS (given the linearity assumption and the zero conditional mean assumption) E(Y|X) = XB

* Thus using LIE: E(Y) = E(E(Y|X)) -> in the sample analogue mean(Y) = mean(XBhat) = mean(Yhat)

* Let's see this in action

clear
set obs 1000

gen x = rnormal() + 5
gen u = rnormal()

gen y = x + u*10

reg y x

predict yhat
sum y yhat

* Example 2: Imagine you are trying to calculate the reccomended cooking times for a frozen food that you have developed that is best for the most people.

* You know that for each 1000 feet above sea level you need to reduce the temperature by 5% (this is entirely fictional).  You have experimented and found the ideal cooking temperature at sea level is 350. The result is E(Y|x)=350*(.95)^x where x is 1000 feet.

* Now you want to calculate a single cooking tempurature reccomendation that gives the ideal tempurature for an entire population.

* You know 30% of consumers live at sea level, 20% at 500 feet, 20% at 1000, 10% at 2000, 10% at 3500, and 10% at 5000.

* Thus expected best temperature reccomendation for a randomly drawn person is:

di .3*350*(.95)^0 + .2*350*(.95)^.5 + .2*350*(.95)^1 + .1*350*(.95)^2 + .1*350*(.95)^3.5 + .1*350*(.95)^5

* Thus E(Y)=E(E(Y|X))

* Note that this is a different temperature than taking the temperature at the average elevation.

di "Average elevation = " .3*0 + .2*500 + .2*1000 + .1*2000 + .1*3500 + .1*5000

di "Temperature reccomendation at average elevation = " 350*(.95)^((.3*0+.2*500+.2*1000+.1*2000+.1*3500+.1*5000)/1000)

No comments :

Post a Comment