Justice Anthony M. Kennedy, left, said Wednesday that he is retiring from the U.S. Supreme Court led by Chief Justice John G. Roberts Jr., right. (AFP Photo/Saul Loeb)

The retirement of Supreme Court Justice Anthony M. Kennedy is all but certain to shift the ideology of the court to the right.

As the court's swing vote, Kennedy is what political scientists call the “median justice." Plot out the ideology of the court's nine members, and you'll find Kennedy smack in the middle with four conservatives on one side and four liberals on the other. The median justice wields considerable power on the court: On decisions that split neatly by ideology, you can't have a majority without the median justice.

Political scientists have used different methods to calculate judicial ideology over the years. One of the most widely used is the Martin-Quinn score, which, at the risk of greatly oversimplifying, tracks how often justices vote with each other in affirming or reversing lower-court cases.

The nice thing about this score is that it allows us to place each justice on an ideological scale, which in turn allows us to track the overall ideology of the Supreme Court over time, including the position of the crucial median justice. Here's what that looks like, going back to 1937.

The thick black line in the middle of the chart is the important one: the ideological position of the median justice. You can see that it doesn't stray too far from the zero line, particularly relative to the thin orange and blue lines denoting the court's most conservative and liberal members, respectively.

Let's focus on the right end of the chart, which brings us close to the present day. There's a thin yellow line there indicating the ideological position of Kennedy. You'll notice it perfectly tracks with the black median justice line.

Here comes the important part: In terms of ideology, the conservative justice closest to Kennedy is Chief Justice John G. Roberts Jr., according to the Quinn-Martin scores. President Trump is almost certainly going to nominate somebody to the right of Roberts. Trump's previous confirmed nominee, Justice Neil M. Gorsuch, for instance, is much closer to Justice Samuel A. Alito Jr. than he is to Roberts on the Quinn-Martin scale.

With Kennedy gone, and (presumably) a conservative to the right of him filling the vacancy, that means that Roberts becomes the court's next median justice. As of the 2016 term, that would shift the ideological score of the median justice rightward, from Kennedy's -.362 to Roberts' +. 257, more than a half a total ideological point.

To put it in simpler terms, the chief justice is now the court's swing vote.

One important caveat is that scores haven't been calculated for the 2017-2018 term, which just wrapped up. There's also some debate among political scientists over the best way to track Supreme Court ideology over time. One big knock against Martin-Quinn scores, for instance, is that they don't at all consider the substance of the cases considered.

But regardless, it's clear that as long as Trump nominates a conservative to the right of Roberts, the balance of ideological power on the court is about to undergo a considerable shift.