Market panic in reaction to a big event is a frequent occurrence, particularly if the event is unexpected.

The U.K.'s decision to leave the European Union was one such unexpected event, as most people thought that the voters would opt to remain in the EU.

As the referendum vote unfolded, markets, currencies and investors exhibited a loss of confidence in both the fate of the U.K. and the EU. This triggered panic selling, whereby investors sold British and EU stocks, and that spilled over into other markets.

But historically, mass selling has done more harm than good to the markets because it undermines the fundamentals and initiates herd-like behavior. When fear takes over, as in the case of the Brexit, investors impulsively try to leave the tumbling markets.

Behavioral finance links investors' psychology to financial markets, with investors tending to react more to bad news than to positive news.

Some of the largest panic selling occurred during rare events such as the stock market crash in 1929 and the financial crisis in 2008. Selling during the 2008 crisis led to huge losses, resulting in investors losing confidence in the financial system.

Since then, global investors have been more cautious, but they still react impulsively and immediately to bad news.

Nobel Laureates George A. Akerlof and Robert J. Shiller in their book "Animal Spirits: How Human Psychology Drives the Economy and Why It Matters for Global Capitalism" (Princeton University Press, 2010) wrote that "Confidence ... is a view of other people's confidence and of other people's perceptions of other people's confidence. It is also a view of the world -- a popular model of current events, a public understanding of the mechanism of economic change as informed by the news media and by popular discussions."

Changes in investor behavior can lead to wide price swings and increased volatility in financial markets.

University of Chicago economist Richard H. Thaler and Yale University's Professor Shiller have said that despite the available information, investors tend to make irrational decisions and trade in the stock markets at unjustified prices. Stock price movements may reflect mass psychology or even irrational trends.

Assessing before selling helps in analyzing the underlying reason for market panic.

The initial market reaction to the Brexit was a strong one but surely not catastrophic. The U.K. will remain in the EU for probably at least two years, which gives long-term investors enough time to assess the real risks of the Brexit on their stocks.

Full details of post-Brexit arrangements with the EU and the rest of the world will only be disclosed during the two-year period.

A diversified portfolio will also help in lowering the risk related to major market fluctuations. When certain stocks are under-performing during an unexpected event, there will always be some that will be performing well. 

See full Brexit coverage here.

This article is commentary by an independent contributor.