Fundamental aspects of human psychology have more to do with why humans tend to divide into different social groups than race, religion, or even affiliation with a particular sports team — at least according to a new computer model created by Yale psychologists.

Rather than studying the question of group formation by examining people, the group of researchers from Yale and University of North Carolina at Chapel Hill designed a program that simulates groups coming together.

The model shows that simple rules of human interaction govern the formation of groups —chiefly how nice individuals are to others and how they treat one’s friends. According to study co-author and Yale professor of psychology David Rand, the findings suggest that deeply rooted elements of human psychology help explain why humans so often break into social groups.

“What we wondered was how you can get this powerful ‘us’ and ‘them’ without religion, race or other similar factors,” said Kurt Gray, a professor of psychology at UNC Chapel Hill and co-lead author of the study.

The computer model, only 80 lines of code long, considered four main factors: the number of people in the group, whether those in the group were trusting or suspicious, the degree to which good deeds went repaid — reciprocity — and the degree to which we share the attitudes of friends towards others, also known as transitivity.

The model indicated that reciprocity and transitivity govern the formation of groups in social interaction, two factors that together create a powerful sense of “us and them,” Gray said.

Reciprocity alone creates many individual relationships but does not itself create groups, Rand said in an email.  Instead, groups begin to form when transitivity and reciprocity work together.

The study demonstrates that the root causes of groups have less to do with social identity than typically thought, said Kevin Lewis, a co-author of the study and professor of sociology at the University of California San Diego.

Although factors such as race and religion do influence the formation of distinct social groups, preference to spend time with someone from the same racial group is actually a manifestation of underlying reciprocity and transitivity, Lewis said.

The type of computer modeling the group used is relatively new, and increasingly common in sociological and psychological experiments, Lewis said. The technique allows researchers to simulate a group of identical people interacting, an impossible task to carry out with real subjects, and the reason the research group decided to model group behavior on the computer. In addition, Rand said the simulation was able to study the consequences of these effects on large populations over long periods of time in a way that is impossible to do with real people.

Gray said the study calls into question the effectiveness of alleviating group conflict by trying to make individuals less sensitive to differences like race or religion.

An interactive demonstration of the study’s model is publicly available online.