Essays On Econometrics With Latent Heterogeneity And Production Function Estimation