Essays on nonparametric and semiparametric econometrics