Estimating average marginal effects in nonseparable structural systems