The Cleveland Cavaliers won the lottery on Tuesday and will make the NBA’s No. 1 overall draft pick for the third time in four seasons. There’s a lot riding on whom they choose. Earlier this week I looked at the value produced by first-round NBA draft picks. These players, especially the highest draft picks, are valuable assets while they’re still on rookie-scale contracts. The average No. 1 overall pick produces the equivalent of $63 million in value during his first five NBA seasons, based on the number of wins he generates for his club. Yet the player drafted first overall this year can be had for about $35 million in salary. These averages, of course, conceal a wide range of outcomes — from LeBron James to Anthony Bennett — but the odds of acquiring a valuable player at a discount are stacked in the team’s favor.

Edges like those aren’t easy to come by in the NBA, however. And the Cavs’ most difficult choice this summer may not be between Andrew Wiggins and Joel Embiid, but what to do about Kyrie Irving, their No. 1 overall pick three drafts ago. They’ll need to determine whether to offer Irving a maximum extension, which would kick in during the 2015-16 season and pay him around $90 million through 2019-20.

These decisions can easily go wrong. The very best players in the league might be worth 20 wins per season or more, which can translate into valuations in the range of $40 million a year — much higher than the maximum salary. However, only the top few players in the league — James, Kevin Durant, Chris Paul and perhaps a half-dozen others — are worth considerably more than the max. And not all players who look to be on a LeBronian trajectory stay the course. The Chicago Bulls’ Derrick Rose won the MVP after his terrific 2010-11 season — a lot more than Irving has accomplished — and the Bulls signed him to a “supermax” extension afterward through 2016-17. Rose has played in just 49 regular-season games since; the deal could wind up being a curse for Chicago.

My earlier article considered cases like these on an anecdotal basis; this one will do so in a more formal way. Here’s the issue: Irving has played his first three NBA seasons, and his team needs to decide whether to offer him a maximum extension. This is a fairly common dilemma for NBA teams; the Indiana Pacers faced it last year with Paul George, for instance, and the Houston Rockets did two years ago with James Harden.

Maximum extensions lock up a player for five years, for his fifth through ninth NBA seasons. If you’ve been reading carefully, you may be wondering what happened to a player’s fourth season. The short answer is that the team needs to decide on a max extension a year ahead of time. Essentially, it loses out on a year’s worth of information. This makes more difference than you might think ; the fourth season is sometimes pivotal in young players’ development. Penny Hardaway’s performance regressed significantly during his fourth season, for instance, the start of a rather steep decline, and his fourth season is when Rose’s injury problems began.

As the name implies, a maximum extension is for the league’s maximum salary and maximum annual raises of 7.5 percent. The maximum salary for a player in his fifth NBA season was $13.7 million last season. However, assuming inflation under the salary cap is 3.5 percent per season, it will be closer to $16.3 million by 2018-19, when the players chosen in the draft this June will enter their fifth year. Factoring in annual raises, that means the price of a maximum extension will be about $94.5 million over five years when Andrew Wiggins or Julius Randle become eligible for one. Or, Wiggins or Randle instead could be eligible for a supermax extension if they meet certain criteria, such as starting on the All-Star team at least twice. Those supermax extensions are 20 percent more expensive, or $113.4 million over five years.

My apologies if this has begun to read like a legal brief. The NBA’s contract rules aren’t simple; there’s a reason that Larry Coon’s salary cap FAQ runs for more than 60,000 words. The “fun” part of the story starts now.

First, let’s look at the typical aging curves for NBA players, based on their position in the draft and the number of years since they were drafted.

The chart shows that the typical first-round draft pick improves significantly during his first and second seasons in the league. Then he has a long and relatively flat peak that persists from about his third through eighth NBA seasons. After that, he begins to decline. The shape of the aging curve is fairly similar regardless of where a player is chosen in the draft. Players chosen higher in the draft are better as rookies, better at their peak, and better in their declining years — but they don’t peak substantially earlier or later than other players.

This represents a reasonably favorable set of circumstances for an NBA team considering a max extension. In buying up a player’s fifth through ninth NBA seasons, it’s still getting him at something close to peak performance. The situation is better than in baseball, when the average player doesn’t hit the free-agent market until he’s something like 30 years old, and already in his decline phase.

So suppose that the No. 1 overall draft pick was always signed to a max extension. Would teams come out ahead on those deals on average?

No; this would be a silly strategy. Based on the past performance of No. 1 overall picks, you’d expect the player chosen first this year to produce the equivalent of $80.5 million in market value from 2018-19 to 2022-23. That’s not bad, but his max deal would cost his team $94.5 million instead.

So let’s allow teams to take a more sophisticated approach. They run a regression on all first-round picks from the lottery era, which provides them with a projection of their player’s performance in his fifth through ninth seasons based on his age, his draft position and his performance in his first three seasons (as measured by win shares). If the player’s projection comes out in the 80th percentile or higher, they offer a max extension. This means that 20 percent of first-round draft picks would get max extensions, or an average of six players per draft class.

This strategy is also not any good for the teams; it’s much too liberal in giving out max contracts. The average player from this group produces about $75 million worth of market value in his extension seasons — about $20 million less than his team would need to pay him.

We have to set the bar a lot higher. Suppose teams extend only the top 5 percent of players, or the equivalent of one or two players per draft class. These players do provide some surplus value during their extension years. Their performance is worth an average of $105.7 million in market value, compared to their $94.5 million in salary. That’s a profit of about $11 million for the teams.

Even so, most of these are good deals for the teams rather than great ones. The majority of these players are worthwhile at the maximum salary, but the majority would not be worth the supermax salary of $113.4 million.

To find players worth the supermax deal, teams need to be pickier still — offering it only to players who rank in the 99th percentile of all first-round picks. There are about 700 players in our sample of lottery-era first-round picks, which means only seven meet this definition: James, Durant, Paul, Hardaway, Shaquille O’Neal, Grant Hill and Tim Duncan. This is a noisy estimate because of the small sample size, but these players produced an average of about $130 million worth of value in their fifth through ninth seasons, well more than both the max and supermax contracts.

But it’s not much of a challenge to identify the 99th percentile players. Instead, the hard part is distinguishing between players in the 95th through 98th percentiles, who generally are worth max extensions, and those in the 90th through 94th percentiles, who usually are not. According to our model, in fact, players in the 90th through 94th percentiles are expected to produce a significantly negative return on investment when signed to max extensions, receiving almost $20 million more in salary than their production is worth.

This is an awfully abstract way to think about NBA players, so let’s look at some examples. The table below lists all players from 2000 through 2014 who would be classified in each grouping after their third NBA season. The guys on the right are the ones you’d have wanted to extend — given what you knew about them at the time. The guys on the left are the ones you wouldn’t.

Each side of the list has a few mild oddities (Ronnie Brewer?), but for the most part the breakdown is reasonably intuitive. The guys on the right side are those who by their third season in the league were serious candidates for one of the three All-NBA teams. In fact, 57 percent of the players on the right-hand list had made at least one All-NBA team by their third season, and almost all the others would have been very reasonable picks. By contrast, just two of the 21 players on the left-hand list had done so (the exceptions were Russell Westbrook and Paul George and they both rated in the 94th percentile, just barely missing the right-hand side of the list).

If you were an NBA team actually contemplating a max-extension offer, you’d want to do more homework on the decision. Still, the following is a pretty good rule of thumb:

Has your guy made an All-NBA team, or would it have been entirely reasonable for him to do so? Then offer him the max extension. If not, then don’t.

If it’s a close call, you might consider the player’s age, his injury history, his advanced defensive metrics, his leadership abilities, positional scarcity, your cap flexibility or whatever else pleases you.

Kyrie Irving hasn’t made an All-NBA team and he isn’t going to this season. But is he a close call or a flat ‘no’? He’s squarely on the left-hand side of our chart based on win shares — and that metric likes Irving a lot better than some other systems. ESPN’s NBA real plus-minus rated Irving as just the 37th (!) best point guard in the league, by contrast, in large part because it rates his defense as awful.

Perhaps Irving’s disappointing season had more to do with motivation and mindset than talent. But it’s important to consider the downside as well as the upside of a max deal. Unless you have a potential 99th percentile player on your hands, the downside is sometimes larger. A very, very good but not quite world-class NBA player — say, Russell Westbrook — is worth a little more than the maximum salary. But a guy who gets hurt or who burns out early — say, Steve Francis — can be a huge albatross. If Irving has a 50 percent chance of turning into Westbrook and a 50 percent chance of following the Francis course, the Cavs probably shouldn’t sign him. (The team also has other options to explore: trading him, locking up his fifth season by making him a qualifying offer, and so forth.)

This analysis also implies that there isn’t much intrinsic value in a draft pick above and beyond what a player gives you while he’s still on the rookie salary scale. Your player will be worth signing to a max extension only 5 percent of the time, and your expected profit on those extensions is only $11 million a pop. Having a 5 percent chance at an $11 million profit is worth just $550,000. By contrast, being too liberal about giving out max extensions to players like Irving can chip away at the value gained from them during their first several seasons.