Estimation and Inference on Nonlinear and Heterogeneous Effects