Twitter, the social media company that uses a bird for its corporate logo, was the canary in the coal mine.  In early February, on a single day of trading, Twitter’s TWTR stock fell 24%, to $50 from $64. The impetus, such as it was, was that ad sales were not increasing as fast as expected. The rest of the market shrugged it off. The same day the Dow Jones industrial average rose 188 to a new high.  A little more than a month later, technology stocks were in free fall, tumbling faster with every whiff of bad news. Facebook FB shares, which had zoomed up 30% in late January and February, fell 20% in March and early April. Netflix’s NFLX shares lost $100.  And it wasn’t just technology stocks that were tanking. Electric car company Tesla’s TSLA shares fell as well. As did many biotechs.  What had changed? If anything, the economy seemed to have improved.  On April 10, the technology heavy Nasdaq Composite index lost 129 points, it’s worst single day drop in more than two and a half years—a swoon that sent the index below 4,000 for the first time in months. Many were saying this was just the beginning of a much larger selloff.  And then—just as quickly as it was—it wasn’t. Though Twitter shares haven’t fully recovered, technology stocks have been mostly rising ever since. Nasdaq is well above where it was before its April dive and is now just a tad off the nearly 14-year high it set on July 3.  What changed, again? Beats me.  I have been reporting on the markets since 1996. In that time, I have covered two major market panics—the dot.com bust and the financial crisis—and dozens of minor ones. All of them have come without much warning, except in retrospect. Most go unnoticed until a good deal of the damage has already been done. And they disappear when you least expected it.  The changes in investor mood often happen in a flash—an infection of outlook that can seem as swift as an epidemic of flu. How and why does it happen? And are there similarities between such market mood swings and the way other things—pathogens, fashion trends, gossip—spread?  In a new Fortune series on Contagion, my colleagues and I set out to explore this murky process, investigating the spread of things as varied as the MERS-coV virus (here and here), M&A rumors, book sales and even a social phenomenon, ahem, such as “the selfie.”  In this same vein, I dove in to a mystery that has been stumping market-watchers and financial journalists—myself included—for ages: What causes investors to go from optimistic to nervous to panicked and back?  The answers that economists have come up with have been mostly unsatisfying or disproven. For a while, many settled on the notion that the market was essentially random, and left it at that.  But then came the financial crisis, which nearly swallowed the entire economy. Again the search for the causes of financial contagions, and how to contain them, became a hot topic.  The good news is that we have new research on what causes market panics, including a major study that came out in just the past few months. The bad news is this likely won’t end the debate either. Here’s what we know, and don’t know, about investors and their freak-outs.  Ask most professional investors and market strategists why stock panics happen and you will mostly get the same answer: Stock prices get too high.  “It’s called exhaustion in market terminology,” says Fred Hickey, who is the long-time editor of the widely followed newsletter, The High-Tech Strategist.  The realization that stocks were significantly overvalued appears to be what led to the 2000 tech bust. In March 2000, Barron’s published an article detailing how fast dotcom companies were running out of cash, and their stocks were overvalued. (Fun side note: Henry Blodget, then a technology stock analyst, said the math of the article was wrong.) That was long before anyone realized the accounting tricks that dot.com companies, and others, like Enron, were playing.  But we didn’t need to know any of that stuff to panic. In the three days following the Barron’s article, the Nasdaq index fell nearly 500 points, or 10%.  Hickey says the same was true in the run up to the financial crisis. Compare stocks to corporate sales or earnings, and it was clear that the market was overvalued in October 2007. And earlier this year, the prices of technology stocks, when you factor in their current growth projections, were trading at higher multiple of earnings than they were back in 2000.  “Why anyone would expect anything other than a decline is beyond me,” says Hickey.  Market value explanations, while a big deal for Wall Streeters, never really held much sway with financial professors. A little over a decade ago, Nobel Prize-winning economist Edward Prescott did a study of stock prices in 1929, before that year’s giant stock market crash. His conclusion: The market didn’t crash in 1929 because stocks were overvalued. If anything, based on what we know now, the market was cheap.  And while there were plenty of stocks that turned out to be worthless when the dotcom market crashed, others were cheap even at the peak. Amazon.com’s stock AMZN , for instance topped out at a split adjusted $89 in 2000. It now trades for $328.  Technology stocks, too, are just as expensive as they were a few months ago. Witness the phenomenon of hitcher app Uber, which was valued in early June at an eye-popping $17 billion—and that was before it raised another $1.2 billion in venture funding. That would make it worth more than Hertz (market capitalization: $13.5 billion), on virtual dotcom paper, that is. This all sounds bubbly, and yet, no one is running to sell.  The Barron’s article in 2000 was not the first time the financial media had raised the warning sign about tech stocks. Yet, for some reason that article stuck.  “The best we can say is that what causes selloffs is changes in investor sentiment,” says Harvard professor Malcolm Baker. “But why that change occurs we really don’t know.”  The theory that most economists prefer to explain stock market selloffs—probably because it comes from their own playbook—starts with supply and demand.  And it explains many market bubbles and busts in new technologies. Often when investors catch wind of an exciting new technology like, say, the Internet—or, today, social media and electric cars—there are few, if any, publicly traded companies.  Investors will pay up for those shares if it’s the only way to get in on the trend. But as more companies that do the same thing go public, or the ones that are public sell more shares, the supply of available shares increases. And as supply rises, prices tend to fall.  And there’s some evidence that’s what happened with technology stocks earlier this year. More than 45 technology companies went public in 2013 and early 2014, including Twitter, a number of other social media companies and game maker King.com KING , which owns the obsessively popular Candy Crush. What’s more, each one of these companies have lockup periods—a time, usually six months, after the IPO—after which insiders can sell shares. That increases the number of shares investors have to gobble up. The expiration of Twitter’s lockup alone made another 500 million shares of social media stock available for trading.  But that doesn’t explain market panics, like we saw earlier this year. If it were all about supply and demand, you would expect the selloffs to be measured and gradual. It also doesn’t explain why more shares of Twitter or King.com would cause investors to dump their holdings of Tesla or a slew of biotech companies, which also sold off in the spring. (In fact, Twitter’s lock-up expired in early May, when technology stocks were recovering.)  Nor does the theory really explain the financial crisis. Houses and mortgage bonds weren’t new, though the supply of both definitely increased during the run-up to the housing bust.  And neither the valuation explanation nor the supply argument really explains why this year’s tech stock selloff didn’t spread. Non-tech stocks, after all, look expensive, too. And many large companies have spent the past few years selling debt. Yet, outside of tech, stocks have continued to rise without barely a hiccup this year.  Tech investor Kevin Landis of Firsthand funds says part of the problem is there’s no obvious leader for tech investors to use as an anchor. A decade ago, investors would look to movements in Microsoft MSFT or Intel INTC . But Microsoft has stumbled and Intel isn’t the powerhouse it used to be. “I don’t think you would say as Telsa goes, so goes the market,” says Landis. “Facebook is going to get there but it’s not there yet.”  That leads us to the latest theory of why market panics happen. In academic circles, at least, there’s been resurgence in interest in a theory that was popular a decade ago but had been dismissed by believers in efficient market theory. But now that the financial crisis has discredited the efficient market hypothesis—clearly houses and mortgage bonds were mispriced—alternative theories are making a comeback.  The theory is called the consumption-based asset pricing model. Most theories of how the stock market works are based on the idea that investors sit around thinking about what Amazon or Apple AAPL might be worth. Together, by buying and selling stock, Mr. Market comes to some conclusion.  But the consumption-based asset pricing model says that’s not the way it works at all. Investors, actually, spend very little time thinking about whether a company’s shares are undervalued or overvalued. Instead, most investors make their investment decisions based on how much money they have and when they will spend it.  “Something that has no cash flows now but a lot in the future, I would be nervous about in a period when all of a sudden I think I am going to need cash,” says Chris Brightman, who leads the research and investment management team at investment advisor Research Affiliates.  In early January, Sydney Ludvigson, an economics professor at New York University who has been a defender of the consumption-based theories, co-authored a study that found that 75% of short-term stock price movements have to do with changes in investors appetite for risk.  It turns out the theory does a pretty good job of explaining the recent tech selloff. In the first quarter, corporate profits weren’t any worse than they were last year. But the economy did slow. And that may have made individuals slightly more concerned about how much cash they had, and whether they would need it sooner than they thought. And if you are worried about needing cash soon, you are probably less likely to invest in companies like Tesla and Twitter, which have a lot of potential, but are not yet producing profit, or a lot of it anyway. But you might still not be concerned about investing in Berkshire Hathaway BRK.B or GE GE or Walmart WMT .  By early April, the economy was starting to pick up again. And when it did technology stocks rebounded.  Nobel Prize-winner Prescott kind of agrees. He thinks the main thing that drives stock prices is tax policy. If investors think they are going to have to pay more in taxes, they will invest less. That doesn’t really explain why tech stocks dropped this year, or in 2008—but the point is, stock market panics are not only driven by a fear of stocks.  And that seems like a pretty good answer as to why people all of a sudden go running for Wall Street’s exits, at least for now.
Why does investor panic suddenly take hold? Here, the fourth installment of a new Fortune series on how things spread.