A Dynamic Stochastic Asset Pricing Model with Heterogeneous Agents