Wharton experts used machine learning to help uncover the secret formula for successful healthy habit formation, and it turns out there’s no one formula.

“There’s this widely spread rumor that it takes 21 days to form a habit. You may have also heard it takes 90 days to form a habit. There are popular books that tout these numbers that don’t have a sound basis in research. What we find is there is no such magic number,” said Katy Milkman, a Wharton professor of operations, information and decisions.

Milkman spoke to Wharton Business Daily on SiriusXM about her recently published study. Wharton professor Angela Duckworth, who co-founded Penn’s Behavior Change for Good Initiative with Milkman, is one of six co-authors* on the piece.

The ‘Magic’ Behind a Healthy Habit

The team including Milkman and Duckworth developed a machine learning methodology to parse millions of data points tracking two behaviors that can become habitual: gym attendance and hand sanitizing. They partnered with 24 Hour Fitness to obtain years of check-in records for more than 60,000 gym members, and they worked with a technology company that tracked whether 5,200 health care providers at 30 hospitals sanitized their hands whenever they entered or exited a patient’s room.

They found that it took, on average, weeks for people to get into the habit of hand sanitizing and months to start going to the gym regularly. The time element isn’t more precise because there was so much variation in the data across individuals, which Milkman said is further proof that a magic number is elusive.

“Gyms have been sort of the fruit fly of habit-formation research.”— Katy Milkman

“This really points to a false belief in the idea of a magic amount of time,” she said. “We’re probably better off focusing on things like how complex is the behavior, how often are you repeating it, what’s the nature of the reward you’re receiving as the main drivers of the habit formation speed, as opposed to a gravitational pull towards a magic number.”

The paper also found that once gym-goers established a habit of regular attendance that could be detected by a machine learning model, they were much less sensitive to an intervention from the gym that provided reminders and rewards to motivate attendance. Milkman said that’s a significant takeaway for marketers.

“We can predict with machine learning when they’re in that state [of habit], and we know once they’ve reached that state, they are going to be harder to perturb off their course,” she said. “That’s also important just for thinking about tailoring and personalizing the kind of offers you provide if you’re a marketer, a health care plan, an employer.”

The Key to Measuring a Healthy Habit

The authors deliberately chose two very different habits because they wanted to make sure the results could be generalized to other contexts. Gym attendance was the easy choice.

“Gyms have been sort of the fruit fly of habit-formation research,” Milkman said. “An enormous amount of work in this literature focuses on gym attendance as the outcome [because] it’s something that’s quite easy to measure without having people report to you and not lie,” Milkman said.

Self-reporting is notoriously inaccurate for dieting, nail-biting, smoking, working out, or anything for which people may not want to confront the truth about their habits, she said. But the electronically monitored gym entry at 24 Hour Fitness provided convenient, accurate data.

The authors then went looking for something else that could provide objective data and found hand sanitizing; the health care providers’ behavior was tracked with RFID technology.

“We thought it was really exciting to pair those two and see how different or similar are they,” Milkman said.

“Data teaches us what’s true — as opposed to what we’d like to believe or what we think is true based on our own observations.”— Katy Milkman

What Can Machine Learning Teach Us Beyond Healthy Habit Formation?

While Milkman said most people who read the study will be intrigued by the results that disprove a magic formula for healthy habit formation, she thinks the biggest contribution of the paper is in the scientific approach taken to analyze the data. It shows what’s possible with machine learning and how it helps researchers get at the ground truth.

“Data teaches us what’s true — as opposed to what we’d like to believe or what we think is true based on our own observations,” she said. “So, it was really exciting to bring 52 million observations to this question, as opposed to [self-report] data from questionnaires or the intuitions of people who are writing self-help books.”

Milkman, whose research focuses on behavioral economics and decision-making, said the machine learning methods applied in this study helped find patterns and nuances in habits so she and her colleagues could better understand how they are formed. She’s eager to use the same methodology to study other kinds of decision-making.

“To our knowledge, our work is the first to look at habit formation happening in the wild, in a naturalistic way, with people going on about their daily lives and their habits taking shape,” she said. “I think there’s enormous creative potential here, and we’re just starting to scratch the surface.”

*Anastasia Buyalskaya, marketing professor at HEC Paris; Colin Camerer, behavioral economics professor at California Institute of Technology; Xiaomin Li, doctoral student at California Institute of Technology; and Hung Ho, doctoral student at the University of Chicago’s Booth School of Business and former Wharton research coordinator.