Essays in public economics and advanced applied econometrics