Kottwitz conjectured a formula for the (semi-simple) trace of Frobenius on the nearby cycles for the local model of a Shimura variety with Iwahori-type level structure. In this paper, we prove his conjecture in the linear and symplectic cases by adapting an argument of Gaitsgory, who proved an analogous theorem in the equal characteristic case.