A data scientist in his 20s explains the secret to Warren Buffett’s optimism

Daniel Acker/Bloomberg | Getty Images

Self-made billionaire and Berkshire Hathaway CEO Warren Buffett, 86, has long been revered as a legendary investor. His annual shareholders' meetings, deemed the "Woodstock for capitalists," bring together tens of thousands of attendees each year to Nebraska.

For the last few months, the business world has dissected Buffett's annual letter for his views on how the market is performing, his advice on investing, the current state of the economy and management tips, among other topics. It's also widely known that the self-made billionaire offers some of the most prized advice around.

Earlier this year, Bill and Melinda Gates even addressed their own annual letter to Buffett, attributing the secret to his success to his unrelenting optimism.

Warren Buffett made $53,000 by age 17

And while the public may be familiar with Buffett's prowess over the years, it's now backed by scientific analysis. Michael Toth, a data scientist at Orchard Platform and a former portfolio analyst at BlackRock, used statistical computing to quantify and prove the billionaire's penchant for positivity over the years.

In March, Toth, 28, performed a sentiment analysis on Buffett's annual Berkshire Hathaway shareholder letters from 1977 to 2016 and revealed several patterns. A sentiment analysis is a method of identifying and quantifying opinions of a particular set of text — in this case, the use is to determine the positive or negative vibes of Buffett's letters.

Toth found that while the vast majority of shareholder letters spanning the past 40 years were positive, only five letters show a negative net sentiment score. But there's a catch.

Michael Toth

"What surprised me was how well these negative letters lined up with negative recession events," Toth tells CNBC. Those five events comprised of the market downturn in 1987 dubbed Black Monday, the recession of 1990, the September 11 attacks and collapse of the dot-com bubble in 2001 and 2002, as well as the Great Recession of 2008.

Toth tells CNBC that the sentiment analysis demonstrated Buffett's ability to balance both optimism and realism.

"He uses words like 'outstanding,' 'excellent,' and 'extraordinary.' To me this communicates that he has strong confidence in his optimism, and that he is comfortable committing to and expressing that optimism," Toth says. "The negative words he uses, particularly cases like 'unusual', and 'difficult' seem to refer to challenges and unique circumstances."

"To me this communicates that even in negativity, Buffett is thinking about solutions and charting a path forward," he adds.

It seems the public speaking class Buffett took at 19 paved the way for his admired communication skills today.

"Generally, Warren Buffett is quite a positive person," Toth says. "When things are going poorly, he's comfortable admitting that and he's comfortable telling others both when Berkshire's performance is bad and when the broader market is bad."

That's "a strong quality in a leader," he says.

How Warren Buffett overcame his fear of public speaking