## Tuesday, July 10, 2012

### The Delta Method

* Traditionally the delta method was and continues to be used in economics to estimate the standard errors of many econometric estimators.

* The delta method typically takes an estimator for which a reasonable standard error estimate is known and transforms that estimator by some function to another estimator.

* See more here: http://en.wikipedia.org/wiki/Delta_method & http://en.wikipedia.org/wiki/Taylor_series
clear
set obs 1000

gen x = rnormal()*5 + 10
* Let's set up a variable x with a mean of 10 and variance of 25

* c=f(x)=x^3
gen c = x^3

* cprime = f'(x) = 3*x^2
gen cprime = 3*x^2

reg x
gen var_hat_c = cprime^2*_se[_cons]^2

qui sum var_hat_c
di "Thus the delta estimate of the standard error of mean(c) is: " r(mean)^.5
reg c
di "While the 'unobservable' draw's se is: " _se[_cons]

* It seems the delta method is working pretty well!

* An alternative would be to bootstrap the errors
bs, rep(100): reg c

* Both methods work well in this example.

***********************************************************
* Let's try something a little different

clear
set obs 1000

gen x = runiform()*10

* c=f(x)=sin(x)+x
gen c = sin(x)+x

* cprime = f'(x) = cos(x)+1
gen cprime = cos(x)+1

reg x
gen var_hat_c = cprime^2*_se[_cons]^2

qui sum var_hat_c
di "Thus the delta estimate of the standard error of mean(c) is: " r(mean)^.5
reg c
di "While the 'unobservable' draw's se is: " _se[_cons]

bs, rep(100): reg c

* The Delta method still seems to be working well.

* As I understand it the Delta method:
*   Less machine time intensive while more algebra intensive.  Taking derivitives above was easy, but when you have multiple explanatory variables and more complex equations things can get pretty ugly.
*   More suceptable to approximation errors (because it is a taylor series expansion)