Nonlinear resistivity of a two-dimensional electron gas in a magnetic field