Essays on theoretical and applied econometrics