Most phylogenetic comparative methods used for testing adaptive hypotheses make evolutionary assumptions that are not compatible with evolution toward an optimal state. As a consequence they do not correct for maladaptation. The "evolutionary regression" that is returned is more shallow than the optimal relationship between the trait and environment. We show how both evolutionary and optimal regressions, as well as phylogenetic inertia, can be estimated jointly by a comparative method built around an Ornstein-Uhlenbeck model of adaptive evolution. The method considers a single trait adapting to an optimum that is influenced by one or more continuous, randomly changing predictor variables.