"I could have done more. I should have done more."

Most of us have probably thought this very thing at several points in our lives, but this particular quote was from Bob Ebeling, who was an engineer on the space shuttle Challenger. Last January, on the 30th anniversary of the shuttle’s explosion, NPR ran a heartbreaking interview with Ebeling about his attempt to warn NASA that it was too cold to launch, and his regret that he failed to convince them.

"I think that was one of the mistakes that God made," he told NPR. "He shouldn't have picked me for the job.”

Hearts that were broken by this first story were warmed by its follow-up a month later. Many listeners wrote to Ebeling, telling him it wasn’t his fault—including his former boss, and one of the executives who approved the launch. Hearing from all these people “helped bring my worrisome mind to ease,” he told NPR.

How much control did Ebeling really have over whether or not NASA launched the shuttle on that too-cold day? It’s impossible to know, but what matters is that he believed he could have changed what happened, if only he had tried harder. And what ultimately healed his regret were assurances that he did all he could, that NASA was so set on launching that he couldn’t have stopped them.

This is the very essence of regret—we can only regret things we think we have control over.  If we had no choice, no agency, if we were but tossed about on the tides of fate, there’d be nothing to regret. And so, regret ends up being the emotional price we pay for free will.

Don’t get me wrong—it’s probably worth it. According to self-determination theory, a framework for understanding human motivation, people have three innate psychological needs: relatedness, autonomy, and competence. The latter two have a lot to do with control—if you have the freedom to make your own choices and feel like you’re good at things, chances are you feel some influence over the direction of your life. And research has shown that feeling in control is hugely beneficial—it’s linked to better mental health and even lowers one’s risk of death. On the contrary, people who feel powerless are less satisfied at work, less successful in school, and seemingly more likely to believe in conspiracy theories, since they’re prone to look for patterns where there are none.

It probably wouldn’t be very pleasant to feel like we were just pawns moved about on the great chessboard of life. (Perhaps we are, whether we feel like it or not, but that’s another discussion altogether.) But the tradeoff for moving our own pieces is that sometimes we make mistakes, and we have to live with them.

There is a good amount of consistency in what people say they regret. Education, career, and romance are the three areas of life where people are most haunted by what could have been, according to one meta-analysis. It’s also well-known that people tend to say they regret things they didn’t do more than things they did. Interestingly, though, this depends on when you ask them. In 1995, Thomas Gilovich and Victoria Medvec reviewed existing evidence on regret and theorized that people tend to regret their actions right after they happen—“I can’t believe I ate the whole thing”—but the more time passes, the less it bothers them. It could be because they take steps to undo whatever action they regret (by taking Alka Seltzer, perhaps), but it’s also likely thanks to what some researchers call the “psychological immune system”: the things we do to make ourselves feel better, like looking for silver linings, or saying we’ve learned from our mistakes.

With actions, we kick ourselves in the moment, but we get over it, says Gilovich, a professor of psychology at Cornell University. But “the mistakes of inaction may only become clear with time. Regrets of inaction are sort of like the last man standing in a battle. The other ones have dissipated.” The reasons you have not to do something, like being too embarrassed to try out for the school play, become less salient with time. Looking back, you may realize the embarrassment wouldn’t have lasted.

Gilovich’s study also found that “the passage of time often brings with it increased confidence that one could have performed an earlier task successfully.” That confidence may be misplaced; people do tend to overestimate how much they can control situations. But while it’s hard to say how much of the world’s regret is wasted on unchangeable things people wrongly believe they could have controlled, in Gilovich’s study, at least, “only 10 of the 213 regrets involved outcomes caused by circumstances beyond the person's control.”

“You certainly can feel a host of bad emotions for things that were visited upon you,” Gilovich says. “Like ‘I was born in a generation where everyone was called to war.’ But people [generally] don’t want to apply the word ‘regret’ to that. It’s more that they rue that period. They wish it weren’t so.”

This element of control has borne out further in more recent research by Neal Roese, a professor of marketing at Northwestern University, who has found that people’s biggest regrets tend to come from areas of life where there was, or is, high opportunity for change.

“There’s two sides to this idea of opportunity,” he says. “The first part is focusing on what things were under your control in the past—what I could have done? How I could have made a difference?”

The second part is that people tend to regret more intensely mistakes that they still have the opportunity to change. If you regret not going to school for another degree, for instance, you may regret it more each year that you don’t do something about it.

“If it’s something that’s really done and you’ve reached a state of closure, you find yourself becoming more reconciled to it,” Roese says. “But when there’s still an opportunity to fix things, then our powers of rationalization are put aside. It’s kind of like the regret is a reminder to get off your duff and do something.”

Rationalizing and analyzing and imagining are all necessary for regret, which is a cognitive emotion, unlike something more primal like fear. If humans weren’t able to imagine other possible worlds than the one they live in, they wouldn’t be able to regret things.

In psychology, contemplating “What if?” is known as “counterfactual thinking.” “Upward counterfactuals” compare reality unfavorably to an imagined alternative—for example, “If I hadn’t been sidetracked by such and such job, I would have been an Academy Award-winning actress,” offers Laura Kray, a professor of leadership at the University of California, Berkeley. “Downward counterfactuals,” meanwhile, favor reality—something like, “My job might be difficult, but at least it’s not as hard as coal mining.”

While too much upward counterfactual thinking (and regret) has been associated with anxiety and depression, it also plays a key role in problem-solving, achieving goals, and improving behavior. “When we think about how an event could have been better, we may experience feelings of regret, but the upside to those feelings is it enables us to make better decisions going forward,” Kray says. “We’re more likely to learn from our experiences when we consider a better possible world.”

Regret, in other words, is an unpleasant but necessary byproduct of psychological processes that help us grow and thrive. “If the cost of that is some of the unpleasant stew that we have to sit in, then so be it,” Gilovich says.

And what about all those people who like to proclaim that they live with no regrets?

“I don’t think we really believe those people,” Gilovich says. “To live is to have at least some regrets, and if you don’t, there’s a concern that maybe you aren’t learning sufficiently.”