According to both central bankers and economic theory, anchored ination expectations are key to successful monetary policymaking. Yet, we know very little about the determinants of those expectations. While policymakers may take some comfort in the stability of long-run ination expectations, the latter is not an inherent feature of the economy. What does it take for expectations to become unanchored? We explore a theory of expectations formation that can produce episodes of unanchoring. Its key feature is state-dependency in the sensitivity of long-run ination expectations to short-run ination surprises. Price-setting agents act as econometricians trying to learn about average long-run ination. They set prices according to their views about future inflation, which hence feed back into actual ination. When expectations are anchored, agents believe there is a constant long-run ination rate, which they try to learn about. Hence, their estimates of long-run ination move slowly, as they keep adding observations to the sample they consider. However, in the spirit of Marcet and Nicolini (2003), a long enough sequence of ination suprises leads agents to doubt the constancy of long-run ination, and switch to putting more weight on recent developments. As a result, long-run ination expectations become unanchored, and start to react more strongly to short-run ination surprises. Shifts in agentsviews about long-run ination feed into their price-setting decisions, imparting a drift to actual ination. Hence, actual inflation can show persistent swings away from its long-run mean. We estimate the model using actual ination data, and only short-run ination forecasts from surveys. The estimated model produces long-run forecasts that track survey measures extremely well. The estimated model has several uses: 1) It can tell a story of how ination expectations got unhinged in the 1970s; it can also be used to construct a counterfactual history of inflation under anchored long-run expectations. 2) At any given point in time, it can be used to compute the probability of ination or deation scares. 3) If embedded into an environment with explicit monetary policy, it can also be used to study the role of policy in shaping the expectations formation mechanism. Joint with Carlos Carvalho (PUC-Rio), Stefano Eusepiz (Federal Reserve Bank of NY), and Bruce Preston (The University of Melbourne).