As it turns out, our instinct to follow the herd can be traced all the way back to the monkeys from which we evolved. A recent study published in the journal Science involved two groups of our cousins, wild vervets. The first group was conditioned to eat only pink-dyed popcorn and reject blue-dyed popcorn, even though both were equally available. The second group was conditioned to eat only blue-dyed popcorn and reject pink-dyed popcorn.

When individual members of the pink popcorn group were moved into a neighborhood inhabited by blue popcorn eaters, the newcomers soon gave up their preference for pink popcorn and began consuming blue. The same thing happened when blue popcorn eaters were introduced into the neighborhood where only the pink food was eaten. They gave up their learned preferences and took up the ways of the monkeys who dominated their new environment.

Our desire to fit in is very strong indeed. Although we like to think of ourselves as independent-minded individuals who can rise above the crowd, the truth is we find comfort in the herd. We are naturally inclined to seek the reassuring company of our fellows. There is a very good reason for this that dates back millions of years.

One of our possible ancestors on the human family tree is a creature known to scientists as “Ardi.” Ardi’s fossil remains were discovered in the early 1990s in the desert in the Afar region of Ethiopia. Her remains were approximately 4.4 million years old. Ardi and her kin did not look too much like modern-day humans, but they did walk upright—at least when they weren’t climbing trees. Though there is little family resemblance, some scientists wondered if we were their direct descendants.

Homo sapiens developed language and music about 50,000 years ago—relatively recently in our species’ history. We began living in settled communities about 15,000 years ago. Our earliest writings are less than 5,000 years old. We developed probability theory and utility theory—cornerstones of investment theory—less than 400 years ago.

Our brains evolved to meet the demands of a world that was very different from the one in which we now live. Ardi’s brain was 400 grams in weight. Our brains weigh 1,400 grams today. If you start the clock when Ardi walked the Earth, we have been “civilized” for only 0.33 percent of our existence. We have been writing things down for only 0.12 percent of our existence. We have been calculating risk for only 0.006 percent of our existence. Even as our brains grew to three times the size of Ardi’s, for most of our history we have been primarily concerned simply with survival.

Sticking with the herd has ensured survival since we first started our evolutionary march. Those who wandered too far from the group became a snack for predators, who far outnumbered our ancestors. Even when the balance of power between predators and humans turned in our favor, sticking with the herd improved our chances of survival. Loners were easy pickings for hostile tribes. There was strength in togetherness.

If you think our days of herd behavior are behind us, visit a middle school or a football stadium or try to get a table at the latest trendy restaurant. Our own chemistry even encourages herd behavior. Our bodies release a hormone known as oxytocin that encourages bonding and cooperative behavior in certain circumstances. Herding means belonging, which feels good.

Although herding has helped ensure our survival for millions of years and is rewarding psychologically and even physiologically, it is extremely harmful to investors. As legendary investor Warren Buffett put it, “Be fearful when others are greedy and greedy when others are fearful.” In other words, do exactly the opposite of what the herd is doing. This is a lesson that has been taught over and over, from the Dutch tulip mania of the 17th century to the tech bubble of the 1990s. Unfortunately, the lesson has been learned by very few investors.

It is easy to dismiss this folksy advice from the fatherly Buffett, as most investors have done through the years, but you do so at your peril. A recent study of herd behavior among mutual fund managers confirmed the validity of Buffett’s homespun wisdom. Hao Jiang of Erasmus University in Rotterdam, the Netherlands, and Michela Verardo of the London School of Economics recently completed a study, entitled Does Herding Behavior Reveal Skill? An Analysis Of Mutual Fund Performance. Their conclusions were clear and convincing. They found that mutual fund managers who invested with the herd had significantly worse performance than managers who exercised independent judgment and invested in a contrarian manner, rejecting conventional wisdom.