On Sunday, Novak Djokovic and Roger Federer will resume the best rivalry in modern men’s tennis. The matchup pits Federer’s serve and volley against Djokovic’s backhand return, as well as Federer’s consistent greatness against Djokovic’s remarkable rise. Federer is already the most accomplished champion in the sport’s history, and, at age 34, is topping off his career with an unprecedented run for his age. Djokovic, at age 28, already is one of the most dominant men’s tennis players in the Open era, and may not have even reached his peak.

The matchup between Djokovic and Federer in the statistical tables isn’t quite as viscerally thrilling as the matchup we’ll see in the U.S. Open final. But it taps into a fundamental question in sports analysis: Is it better to do what Djokovic has done — reach a level no one else has, even if just for a year or a month — or is greatness defined by Federer’s career arc: peaking slightly lower but sustaining that peak for longer?

We didn’t delve into that question in great detail when writing about women’s tennis because we were focusing on Serena Williams. Her standing relative to Steffi Graf and Martina Navratilova doesn’t change whether you look at peak or sustained value — though it could if she stays as good as she is now, at age 33, or even continues to get better.

In the men’s game, though, whether you place greater weight on peaks or consistency makes a huge difference. Djokovic is playing at a level virtually unseen in the sport, topping even Federer’s best years a decade ago. But Federer is nearly as good now as he was then, and has been improving over the last two years, giving him unprecedented levels of career value.

Before we delve deeper into what we mean by all this, we acknowledge that this might all sound odd to tennis buffs. From 2004 to 2007, Federer won 11 Grand Slam titles. Djokovic’s best four-year stretch, from 2011 to 2014, brought him just six. How is Djokovic’s peak higher than Federer’s? And what about all the guys other than Federer who have more majors than Djokovic? Rafael Nadal and Pete Sampras have 14. Bjorn Borg has 11. Djokovic has just nine.

Baseline: A U.S. Open mini-podcast

Carl Bialik and Grantland’s Brian Phillips discuss Roberta Vinci’s upset of Serena Williams and preview the Djokovic-Federer final. For more subscribe to our sports podcast Hot Takedown.

But merely counting Slam titles isn’t the only way to compare all-time greats. We used Elo — a ratings system initially used in chess and adapted to many other competitive endeavors by us and others — to process tens of thousands of tennis matches in order to rank players against their peers, predecessors and successors. Beat a player and gain points; get beaten and lose points; and the number of points you gain or lose depend on how both of you were rated going into your match.

In his prime, Federer had to beat some great players, including a young Djokovic and Nadal and an older Andre Agassi. But the challenge Djokovic has overcome is more formidable. Since his rise to No. 1 in the official rankings and in our Elo rankings in 2011, he has competed with Nadal and Andy Murray in their primes, and a still-dangerous Federer.

That competition has helped bring Djokovic today to the highest peak of anyone in our data set, edging just ahead of Borg and Federer. Djokovic peaked following his semifinal win at this year’s French Open , reaching one-tenth of a point higher than Borg reached after his semifinal win at the 1980 U.S. Open. (They both lost the subsequent final.) Djokovic is still within striking distance of that high now. The chart also shows how closely matched he, Federer, Nadal and Murray were in 2010. They were truly a Big Four then, and there was no telling who would be the biggest of them in the subsequent few years. It turned out to be Djokovic.

If it looks to you like Elo judges Federer’s prime harshly, know that it is kinder to him than it is to the two most recent American greats, Sampras and Agassi. They faced few great rivals other than each other during their peak years in the 1990s, yet both often lost early in tournaments and weren’t as dominant away from Grand Slams as they were in them. Murray, who has won just two Grand Slam titles, peaked higher than either of them did. The closest competitors to today’s current crop of stars were Borg and John McEnroe, when they challenged each other and dominated almost everyone else in the 1980s.

Sorting the players by age shows how well Federer is holding up in his mid-30s. It also shows how steeply Nadal has dropped in his late 20s. His recent falloff looks like McEnroe’s and Sampras’s at a similar age.

Breaking down results by matches is only one of several options for using Elo to rate all-time greats. We could also treat each set, or each game, as its own mini-victory. This is a more appealing option in men’s tennis which, unlike the women’s game, requires best of five sets to win Grand Slam matches, while most non-major events are best of three. That means rating players by matches won not only treats Grand Slam matches the same as others in less famous, less lucrative tournaments, but also that any one set in a Grand Slam tournament counts for less than one elsewhere.

Calculating Elo by sets is just as good at predicting winners in matches as is Elo by matches, but it tells a somewhat different story.

Nadal peaked even higher than Djokovic in Elo rating by set, and Djokovic himself was better in 2011 than today. But all three contemporary stars (Federer included) lag behind Borg and McEnroe, who dominated the Slams in the early 1980s. Elo by game skews the results toward Borg and Nadal because they are the two greatest clay-court players of all time, and clay is the surface where breaking serve is the easiest. That makes it easier for the better player to win sets by scores like 6-0 and 6-1; an equally dominant matchup on grass might yield set scores more like 6-3 or 6-4.

But who is the greatest of all time? Accounting for both the highest peak and the longest stretch of dominance is more complicated than looking at some pretty charts and spotting whose peak is highest. In baseball, greatness is most regularly measured in wins above replacement, which tallies all the wins players have added to teams in their career by being better than a theoretical replacement-level player. That player is someone who is right on the fringe of the majors, getting called up and sent back to the minors throughout his career. He’s something like the 500th best major leaguer. But the 500th best men’s tennis player is really a couple of leagues below the likes of Djokovic et al. Even No. 100, on the fringes of direct entry into Grand Slam tournaments, is losing more matches than he’s winning and rarely facing the very best.

What we’re really looking for is something more like GOATness Above Greatness, or, as we like to call it, GAG. We want to measure how much the all-time greats separated themselves from mere greatness throughout their careers. But how to define ‘mere greatness’? We tried a few possibilities: the median level of the top 32 players at any given time, or the top 16, top eight, top four — even the top two. Players could only gain points for being above mere greatness, not lose them when they were below it. (We did it that way so players wouldn’t be penalized for the years when they were on their way up on tour, or injured, or on the decline at the end of their careers.)

No matter which threshold we chose, and no matter whether we rated players by match, set or game, Federer reigned as the GAG GOAT. His current success is just running up the score. Then again, Djokovic and Nadal already rank high and are more than five years younger than Federer. If they can do what he’s doing at 34, his claim to best ever might have to fall back to the simple count of major titles. If you set replacement value at a typical top-two player, and Djokovic maintains his high level, there’s a chance he’ll catch Federer in the next couple of years. Nadal, though, would have to reverse his recent decline to compete.

(Don’t trust the GAG rankings entirely, though. How we define mere greatness shuffles everyone below Federer on the list. )

No matter how you rank the players, the two strands of tennis competition — in the stats tables and on the court — are well aligned: Djokovic’s strongest case for GOAT status is to beat Federer on Sunday, keep winning after that, and add longevity to his historic peak.