Tuesday, September 3, 2013

When LAD is more efficient than OLS

* There are many potential cases when LAD (least absolute deviations) is a more e
fficient estimators of the linear model than OLS (ordinary least squares).
* These cases are characterized by data in which tails of the errors tend to be wide. * With errors distributed normally we know that OLS is the most efficient estimator. * Let's define a small command to show us the relative estimator efficiencies cap program drop OLSLAD program define OLSLAD, rclass clear set obs `1' // set the observations equal to the first argument if "`2'"=="norm" gen u = rnormal()*5 * Since Stata does not have a built in LaPlace distribution * I will simulate one by solving for the probability * and generating the error term from an inversion of a uniform draw. if "`2'"=="laplace" { gen u0 = runiform() gen u1 = rbinomial(1,.5) gen u = (-1)^u1 * ln(2*u0) * 6 } gen x = rnormal() gen y = x*1 + u reg y x return scalar OLSb = _b[x] qreg y x return scalar LADb = _b[x] end OLSLAD 10000 "norm" hist u, title("Normal Distribution")
OLSLAD 10000 "laplace" hist u, title("LaPlace Distribution")
* Seems to be working well, let's simulate it 1,000 times. simulate OLSb=r(OLSb) LADb=r(LADb), rep(1000): OLSLAD 1000 "norm" sum * We can see that both models produce unbiased estimators though OLS * has a standard deviation which is about 3/4 the size of LAD simulate OLSb=r(OLSb) LADb=r(LADb), rep(1000): OLSLAD 1000 "laplace" sum * Again, both models are unbiased yet now LAD is slightly more efficient * than OLS. As sample size increases LAD will gain efficiency. This * is the result of LAD being the MLE estimator of a linear model when * the distribution of errors follows a LaPlace. * It is easy to show that a LaPlace distribution is maximized when * the estimator choice is LAD. Formatted By Econometrics by Simulation

No comments:

Post a Comment