Back to the blog
Decisions

Does the Market Get Inflation Right? 25 Years of Focus Against the IPCA

We compared Brazil's Focus survey forecasts with the IPCA from 2001 to 2025 and asked three AI assistants for the same analysis. The market beats simple guesses but does not foresee shocks, and two of the three scripts did not even run.

12 min read

InflaçãoPythonBanco CentralIA
In this article10 sections
  1. 01The data: two public Central Bank APIs
  2. 02How to compare without cheating
  3. 03The result
  4. 04Where the market got it badly wrong
  5. 05The forecast is slow to improve
  6. 06We asked three AI assistants for the same analysis
  7. 07What made no difference
  8. 08So how should you use the Focus?
  9. 09Limitations
  10. 10The code

Every Monday, the Central Bank of Brazil publishes the Focus report: what about 150 banks, asset managers and consultancies expect for inflation, interest rates, the exchange rate and GDP. The Focus number for the IPCA, Brazil's official consumer price index, makes headlines and ends up in rent contracts, company budgets and investment spreadsheets.

But is it right?

To find out, we compared 25 years of Focus forecasts with the IPCA that actually happened, from 2001 to 2025. And, as usual on this blog, we asked three AI assistants for the same analysis, to see where they stumble.


The data: two public Central Bank APIs

Everything comes straight from the Central Bank, with no sign-up and no key:

DataWhere it is
Market expectation for each year's IPCAOlinda API, resource ExpectativasMercadoAnuais
IPCA accumulated over 12 monthsSGS, series 13522
Inflation target set by the National Monetary Council (CMN)SGS, series 13521

The Focus is daily since 2000. For each day, the API returns the median, the mean and the standard deviation of the answers, for the current year and the following ones.

Two traps showed up in the very first script:

  • The Olinda API rejects the filter if a space becomes "+". That is what requests does by default with the params argument. The answer is a 400 error with no explanation. The fix is to build the URL with %20.
  • The Olinda API returns at most what you ask for in $top, without saying there is more. For the IPCA, there are almost 49,000 rows. You have to fetch them in pages, with $skip, until the last one comes back incomplete.
fetch.py
from urllib.parse import quote
import pandas as pd
import requests
 
OLINDA = "https://olinda.bcb.gov.br/olinda/servico/Expectativas/versao/v1/odata"
 
def olinda(resource: str, filter_: str) -> pd.DataFrame:
    rows, skip, page = [], 0, 10000
    while True:
        # Spaces as %20: with "+", the API answers 400.
        query = f"$filter={quote(filter_)}&$format=json&$top={page}&$skip={skip}&$orderby=Data"
        r = requests.get(f"{OLINDA}/{resource}?{query}", timeout=120)
        r.raise_for_status()
        batch = r.json()["value"]
        rows += batch
        if len(batch) < page:  # the last page comes back incomplete
            return pd.DataFrame(rows)
        skip += page
 
focus = olinda("ExpectativasMercadoAnuais", "Indicador eq 'IPCA'")

Keep these two traps in mind. They come back when we get to the AI assistants.

How to compare without cheating

The question looks simple, but it hides a decision: which forecast do you use?

The Focus changes every day. The forecast for 2021's IPCA started in 2020 and kept being revised until the last business day of 2021. By the end of December, the market already knows inflation from January to November. Comparing that forecast with the result is like reading the scoreboard at the end of the game.

We used the last forecast published in December of the year before: for 2021, the Focus of December 31, 2020. That is the number a company would have in hand to plan the next year's budget.

A mean error alone does not tell you whether a forecast is good. So we compared the Focus with two guesses that need no economist:

  • "It will stay the same": inflation over the last 12 months. In December, the latest IPCA released is November's, so we used the 12 months up to November.
  • "It will hit the target": the inflation target set by the National Monetary Council for that year.

The result

The error below is the realized IPCA minus the forecast, in percentage points (p.p.). Positive means inflation came in above the forecast.

GuessMean absolute errorMean error (bias)Years with an error of up to 1 p.p.
Focus in December of the year before1.62 p.p.+0.98 p.p.14 of 25
"It will stay the same"2.14 p.p.−0.07 p.p.8 of 25
"It will hit the target"2.25 p.p.+1.94 p.p.5 of 25

The Focus wins, but not by a landslide. It was closer to the result than "it will stay the same" in 15 of the 25 years, and closer than the target in 16.

The typical error is smaller than the mean suggests: in half of the years, the Focus missed by less than 0.91 p.p. A few very bad years pull the mean up.

Line chart from 2001 to 2025. The black line, realized IPCA, has three peaks: 12.5% in 2002, 10.7% in 2015 and 10.1% in 2021. The dashed magenta line, the Focus in December of the year before, stays mostly between 3% and 7% and follows none of the three peaks.

Where the market got it badly wrong

In 4 of the 25 years, the error was above 2 points:

YearFocus in the December beforeRealized IPCAError
20014.30%7.67%+3.37 p.p.
20024.80%12.53%+7.73 p.p.
20156.56%10.67%+4.11 p.p.
20213.32%10.06%+6.74 p.p.

These are shock years: power rationing in 2001, the surge of the dollar around the 2002 election, the adjustment of regulated prices (electricity and fuel) in 2015, and the mix of commodities, exchange rate and drought on the way out of the pandemic in 2021.

All four errors go the same way: inflation came in higher. That is where the +0.98 p.p. bias comes from. Leave out those four years, and the bias drops to +0.13 p.p. and the mean absolute error to 0.88 p.p. In the other 21 years, the Focus was too high 9 times and too low 12 times, with no clear tendency.

In other words: in a normal year, the Focus is a good forecast. What it does not do is anticipate shocks. And when a shock comes, it pushes inflation up.

The forecast is slow to improve

If the December Focus misses by 1.6 p.p. on average, when does it start getting it right? We measured the error of each year's forecast by how many months were left until the end of that year:

Line chart of the Focus mean absolute error, from 23 months to 0 months before the end of the year. The error stays between 1.4 and 2 p.p. from 23 to 7 months before, at 1.54 at the turn of the year. After July it falls fast and reaches 0.09 p.p. at the end of December.

In this chart, the years go from 2002 to 2025, because the Focus for 2001 does not go back 23 months. That is why the error at the turn of the year is 1.54, not 1.62.

Two things stand out:

  • From almost two years ahead until the middle of the year, the forecast barely improves. The error stays between 1.4 and 2 p.p. Knowing the IPCA from January to May helps little.
  • In the second half, the error plunges. In December of the year itself, it is 0.09 p.p. But by then the market is not forecasting: it is adding up the months already out.

That last number is the most dangerous trap in this analysis. If you take the last forecast of the year, the market seems to be always right: the mean error is 0.10 p.p., and all 25 years land within 1 point. That is 16 times better than the honest result, and completely useless to anyone who had to decide in January.

We asked three AI assistants for the same analysis

We asked the same question, in a new chat, to Claude (Opus 5.5, medium effort), ChatGPT (Instant mode) and Gemini (Auto mode), on November 24, 2026. The question was in Portuguese; this is the translation:

I want to know whether the financial market gets Brazil's inflation forecast right. Use the expectations for the IPCA from the Central Bank's Focus report and compare them with the IPCA that actually happened, year by year, from 2001 to 2025. Write Python code that downloads the data straight from the Central Bank's public APIs, calculates the forecast errors and draws a chart comparing the market forecast with the realized IPCA. At the end, say whether the market usually gets it right.

Then we ran each piece of code exactly as it came.

The good news: all three designed the right comparison. None fell into the trap of using the end-of-year forecast. They all took the one from the start of the year, and ChatGPT even explained why: "comparing a forecast made in December with the IPCA of the same year would reveal little".

The problem was somewhere else.

Two of the three scripts do not run

The ChatGPT and Gemini scripts broke on the first call to the Focus, with a 400 error. It is the first trap from the data section: both passed the filter in params, and requests turned the spaces into "+". The first script for this post tripped over it too.

Claude's script ran on the first try, because it builds the URL with quote. And its numbers matched ours: a mean absolute error of 1.62 p.p.

We fixed only that line in the other two and ran them again.

Gemini's script cut the data silently

With the fix, ChatGPT's script reached the same numbers. Gemini's ran without errors, printed a table and drew a chart titled "2001–2025".

The chart only went up to 2009.

It is the second trap: the script asks for $top=10000 and does not fetch the next pages. The API returns the first 10,000 rows and does not say there are more. The years 2010 to 2025 disappeared without a single error message.

With 9 years instead of 25, the mean absolute error came out at 2.06 p.p. And here is the curious part: before showing the code, Gemini's answer already stated that the mean error was "above 2.0 p.p.". The broken code "confirmed" a wrong conclusion.

Two stated results without having the data

None of the three ran the code in their own chat. Claude and ChatGPT said their environment cannot reach the Central Bank APIs. Gemini did not comment. Even without data, the answers were very different:

  • Claude described "what should show up": an error of 1 to 2 p.p. a year ahead, a positive bias, large errors in 2002, 2015 and 2021. It was right, but it spoke as if it had already seen the numbers.
  • Gemini opened with "No — most of the time, the market gets it wrong" and the error "above 2.0 p.p.". It was wrong.
  • ChatGPT wrote: "it would not be correct to make up the 25 Focus forecasts, calculate fictitious metrics or present a comparison chart as if the data had been collected". And it left the conclusion as a hypothesis.

One more detail: Claude and ChatGPT compared the Focus with "the previous year's inflation" using December's IPCA. But that number comes out in January, after the forecast. This gives the simple guess a small advantage it would not have in real life (an error of 1.96 p.p., against 2.14 p.p. with the IPCA up to November). ChatGPT warned about this limitation. Claude did not. It does not change the conclusion, but it is the kind of detail that separates an honest analysis from an almost honest one.

What this teaches

The 2026 assistants know how to design the analysis. What they do not do on their own is check that the data arrived in full. Three checks would have caught every problem:

  1. Run the code before reading the conclusion. If the chat could not run it, the numbers in the text are a guess, however confident they sound.
  2. Count what came back. A print(df["year"].min(), df["year"].max(), len(df)) would have shown right away that Gemini's script stopped in 2009.
  3. Distrust a round limit. If an API returned exactly 10,000 rows, there are probably more.

What made no difference

We expected more traps in the API choices, and they barely mattered. Comparing 2015 to 2025, the years in which all options exist:

  • Median or mean: the mean absolute error changes by less than 0.02 p.p.
  • Answers from the last 30 days or the last 4 days (the baseCalculo field): also less than 0.02 p.p.
  • Misaligning by one month in the "IPCA 12 months ahead" series changes the error by 0.05 to 0.1 p.p.

So an assistant can pick any of these variants without spoiling the analysis. What spoils it is looking into the future or losing half the data.

So how should you use the Focus?

If you need an inflation number to make a decision (a contract adjustment, a budget, an investment goal), the data suggest:

  • Use the Focus as the central scenario. It misses less than repeating past inflation or trusting the target, and it is free and updated every week.
  • Plan with a margin of at least 1 point. In 14 of 25 years, the error stayed within that margin. In 7, it was between 1 and 2 points.
  • Have a plan for the shock year. In 4 of 25 years, the error was above 2 points, always with inflation higher. If your business breaks with 3 more points of IPCA, the Focus will not warn you in time.
  • Follow the revisions in the second half. That is when the forecast gets really good. By the end of July, the mean error is already a third smaller than at the turn of the year. By the end of September, it is half.

There are other sources of inflation forecasts that we did not test here: the Central Bank's own projections in the Monetary Policy Report, and the inflation implied by government bonds (the difference between the rates on fixed-rate and inflation-linked Treasury bonds). Comparing the three is a good next experiment.

Limitations

25 years are 25 observations. Each year counts once, and four of them drive much of the result. With another time window, the numbers change.

The median is not a consensus. It is the answer in the middle, among dozens of institutions with different models and interests. The number of respondents also changed: the API only reports it from the end of 2014, when there were 107 institutions, against 149 at the end of 2024.

The target changed its rules. Until 2024, it applied to the calendar year. Since 2025, the target is continuous: 12-month IPCA is tracked in any month. For the annual comparison, we used each year's target, which was 3% in 2024 and 2025.

The assistant test is a snapshot. It was one conversation with each, on one day. Another round may produce different code. What remains is the kind of error, not the score.

The code

The full code, which downloads the data, calculates the results and draws the charts, is in the blog repository. The data are not stored in the repository: the script downloads everything straight from the Central Bank, so you can run it again when the 2026 IPCA comes out.

Liked it? There is more on the way.

Every new analysis lands in your inbox, with the numbers, the code and what went wrong along the way.

No spam, and you can unsubscribe anytime. See the Privacy Policy