In this paper, I show how gradient-based optimization methods can be used to estimate stochastic dynamic models in economics. By extending the state space to include all model parameters, I show that we need to solve the model only once to do structural estimation. Parameters are then estimated...