Essays in theoretical and applied econometrics