A few years ago, a young man named Kyle Behm took a leave from his studies at Vanderbilt University in Nashville, Tennessee. He was suffering from bipolar disorder and needed time to get treatment. A year and a half later, Kyle was healthy enough to return to his studies at a different university. Around that time, he learned from a friend about a part-time job. It was just a minimum-wage job at a Kroger supermarket, but it seemed like a sure thing. His friend, who was leaving the job, could vouch for him. For a high-achieving student like Kyle, the application looked like a formality.

But Kyle didn’t get called in for an interview. When he inquired, his friend explained to him that he had been “red-lighted” by the personality test he’d taken when he applied for the job. The test was part of an employee selection program developed by Kronos, a workforce management company based outside Boston. When Kyle told his father, Roland, an attorney, what had happened, his father asked him what kind of questions had appeared on the test. Kyle said that they were very much like the “five factor model” test, which he’d been given at the hospital. That test grades people for extraversion, agreeableness, conscientiousness, neuroticism, and openness to ideas.

At first, losing one minimum-wage job because of a questionable test didn’t seem like such a big deal. Roland Behm urged his son to apply elsewhere. But Kyle came back each time with the same news. The companies he was applying to were all using the same test, and he wasn’t getting offers.

Roland Behm was bewildered. Questions about mental health appeared to be blackballing his son from the job market. He decided to look into it and soon learned that the use of personality tests for hiring was indeed widespread among large corporations. And yet he found very few legal challenges to this practice. As he explained to me, people who apply for a job and are red-lighted rarely learn that they were rejected because of their test results. Even when they do, they’re not likely to contact a lawyer.

Behm went on to send notices to seven companies, including Home Depot and Walgreens, informing them of his intent to file a class-action suit alleging that the use of the exam during the job application process was unlawful. The suit, as I write this, is still pending. Arguments are likely to focus on whether the Kronos test can be considered a medical exam, the use of which in hiring is illegal under the Americans with Disabilities Act of 1990. If this turns out to be the case, the court will have to determine whether the hiring companies themselves are responsible for running afoul of the ADA, or if Kronos is.

But the questions raised by this case go far beyond which particular company may or may not be responsible. Automatic systems based on complicated mathematical formulas, such as the one used to sift through Behm’s job application, are becoming more common across the developed world. And given their scale and importance, combined with their secrecy, these algorithms have the potential to create an underclass of people who will find themselves increasingly and inexplicably shut out from normal life.

It didn’t have to be this way. After the financial crash, it became clear that the housing crisis and the collapse of major financial institutions had been aided and abetted by mathematicians wielding magic formulas. If we had been clear-headed, we would have taken a step back at this point to figure out how we could prevent a similar catastrophe in the future. But instead, in the wake of the crisis, new mathematical techniques were hotter than ever, and expanding into still more domains. They churned 24/7 through petabytes of information, much of it scraped from social media or e-commerce websites. And increasingly they focused not on the movements of global financial markets but on human beings, on us. Mathematicians and statisticians were studying our desires, movements, and spending patterns. They were predicting our trustworthiness and calculating our potential as students, workers, lovers, criminals.

This was the big data economy, and it promised spectacular gains. A computer program could speed through thousands of résumés or loan applications in a second or two and sort them into neat lists, with the most promising candidates on top. This not only saved time but also was marketed as fair and objective. After all, it didn’t involve prejudiced humans digging through reams of paper, just machines processing cold numbers. By 2010 or so, mathematics was asserting itself as never before in human affairs, and the public largely welcomed it.

Most of these algorithmic applications were created with good intentions. The goal was to replace subjective judgments with objective measurements in any number of fields – whether it was a way to locate the worst-performing teachers in a school or to estimate the chances that a prisoner would return to jail.

These algorithmic “solutions” are targeted at genuine problems. School principals cannot be relied upon to consistently flag problematic teachers, because those teachers are also often their friends. And judges are only human, and being human they have prejudices that prevent them from being entirely fair – their rulings have been shown to be harsher right before lunch, when they’re hungry, for example – so it’s a worthy goal to increase consistency, especially if you can rest assured that the newer system is also scientifically sound.

The difficulty is that last part. Few of the algorithms and scoring systems have been vetted with scientific rigour, and there are good reasons to suspect they wouldn’t pass such tests. For instance, automated teacher assessments can vary widely from year to year, putting their accuracy in question. Tim Clifford, a New York City middle school English teacher of 26 years, got a 6 out of 100 in one year and a 96 the next, without changing his teaching style. Of course, if the scores didn’t matter, that would be one thing, but sometimes the consequences are dire, leading to teachers being fired.

Algorithms are being used to determine how much we pay for insurance, or what the terms of our loans will be

There are also reasons to worry about scoring criminal defendants rather than relying on a judge’s discretion. Consider the data pouring into the algorithms. In part, it comes from police interactions with the populace, which is known to be uneven, often race-based. The other kind of input, usually a questionnaire, is also troublesome. Some of them even ask defendants if their families have a history of being in trouble with the law, which would be unconstitutional if asked in open court but gets embedded in the defendant’s score and labelled “objective”.

It doesn’t stop there. Algorithms are being used to determine how much we pay for insurance (more if your credit score is low, even if your driving record is clean), or what the terms of our loans will be, or what kind of political messaging we’ll receive. There are algorithms that find out the weather forecast and only then decide on the work schedule of thousands of people, laying waste to their ability to plan for childcare and schooling, never mind a second job.

Their popularity relies on the notion they are objective, but the algorithms that power the data economy are based on choices made by fallible human beings. And, while some of them were made with good intentions, the algorithms encode human prejudice, misunderstanding, and bias into automatic systems that increasingly manage our lives. Like gods, these mathematical models are opaque, their workings invisible to all but the highest priests in their domain: mathematicians and computer scientists. Their verdicts, even when wrong or harmful, are beyond dispute or appeal. And they tend to punish the poor and the oppressed in our society, while making the rich richer. That’s what Kyle Behm learned the hard way.

Finding work used to be largely a question of whom you knew. In fact, Kyle Behm was following the traditional route when he applied for work at Kroger. His friend had alerted him to the opening and put in a good word. For decades, that was how people got a foot in the door, whether at grocers, banks, or law firms. Candidates then usually faced an interview, where a manager would try to get a feel for them. All too often this translated into a single basic judgment: is this person like me (or others I get along with)? The result was a lack of opportunity for job seekers without a friend inside, especially if they came from a different race, ethnic group, or religion. Women also found themselves excluded by this insider game.

Companies like Kronos brought science into corporate human resources in part to make the process fairer. Founded in the 1970s by MIT graduates, Kronos’s first product was a new kind of punch clock, one equipped with a microprocessor, which added up employees’ hours and reported them automatically. This may sound banal, but it was the beginning of the electronic push – now blazing along at warp speed – to track and optimise a workforce.

In the UK, 71% of employers use some form of psychometric test for recruitment

As Kronos grew, it developed a broad range of software tools for workforce management, including a software program, Workforce Ready HR, that promised to eliminate “the guesswork” in hiring. According to its web page, Kronos “can help you screen, hire, and onboard candidates most likely to be productive – the best-fit employees who will perform better and stay on the job longer”.

Kronos is part of a growing industry. The hiring business is becoming automated, and many of the new programs include personality tests like the one Kyle Behm took. It is now a $500 million annual business and is growing by 10 to 15% a year, according to Hogan Assessment Systems Inc, a company that develops online personality tests. Such tests now are used on 60 to 70% of prospective workers in the US, and in the UK, according to the Association of Graduate Recruiters, 71% of employers use some form of psychometric test for recruitment.

Even putting aside the issues of fairness and legality, research suggests that personality tests are poor predictors of job performance. Frank Schmidt, a business professor at the University of Iowa, analysed a century of workplace productivity data to measure the predictive value of various selection processes. Personality tests ranked low on the scale – they were only one-third as predictive as cognitive exams, and also far below reference checks. “The primary purpose of the test,” said Roland Behm, “is not to find the best employee. It’s to exclude as many people as possible as cheaply as possible.”

You might think that personality tests would be easy to game. If you go online to take a five factor personality test, it looks like a cinch. One question asks: “Have frequent mood swings?” It would probably be smart to answer “very inaccurate.” Another asks: “Get mad easily?” Again, check no.

In fact, companies can get in trouble for screening out applicants on the basis of such questions. Regulators in Rhode Island found that CVS Pharmacy was illegally screening out applicants with mental illnesses when a personality test required respondents to agree or disagree with such statements as “People do a lot of things that make you angry” and “There’s no use having close friends; they always let you down.”

Facebook Twitter Pinterest Illustration by Nathalie Lees

More intricate questions, which are harder to game, are more likely to keep the companies out of trouble. Consequently, many of the tests used today force applicants to make difficult choices, likely to leave them with a sinking feeling of “Damned if I do, damned if I don’t”.

McDonald’s, for example, recently asked prospective workers to choose which of the following best described them: “It is difficult to be cheerful when there are many problems to take care of” or “Sometimes, I need a push to get started on my work.”

In 2014, the Wall Street Journal asked a psychologist who studies behaviour in the workplace, Tomas Chamorro-Premuzic, to analyse thorny questions like these. The first of the two answers to the question from McDonald’s, Chamorro-Premuzic said, captured “individual differences in neuroticism and conscientiousness”; the second, “low ambition and drive”. So the prospective worker is pleading guilty to being either high-strung or lazy.

A Kroger supermarket question was far simpler: Which adjective best describes you at work, unique or orderly? Answering “unique”, said Chamorro-Premuzic, captures “high self-concept, openness and narcissism”, while “orderly” expresses conscientiousness and self-control.

Note that there’s no option to answer “all of the above”. Prospective workers must pick one option, without a clue as to how the program will interpret it. And some of the analysis will draw unflattering conclusions.

Defenders of the tests note that they feature lots of questions and that no single answer can disqualify an applicant. Certain patterns of answers, however, can and do disqualify them. And we do not know what those patterns are. We’re not told what the tests are looking for. The process is entirely opaque.

What’s worse, after the model is calibrated by technical experts, it receives precious little feedback. Sports provide a good contrast here. Most professional basketball teams employ data geeks, who run models that analyse players by a series of metrics, including foot speed, vertical leap, free-throw percentage, and a host of other variables. Teams rely on these models when deciding whether or not to recruit players. But if, say, the Los Angeles Lakers decide to pass on a player because his stats suggest that he won’t succeed, and then that player subsequently becomes a star, the Lakers can return to their model to see what they got wrong. Whatever the case, they can work to improve their model.

Now imagine that Kyle Behm, after getting red-lighted at Kroger, goes on to land a job at McDonald’s. He turns into a stellar employee. He’s managing the kitchen within four months and the entire franchise a year later. Will anyone at Kroger go back to the personality test and investigate how they could have got it so wrong?

Not a chance, I’d say. The difference is this: Basketball teams are managing individuals, each one potentially worth millions of dollars. Their analytics engines are crucial to their competitive advantage, and they are hungry for data. Without constant feedback, their systems grow outdated and dumb. The companies hiring minimum-wage workers, by contrast, act as if they are managing herds. They slash expenses by replacing human resources professionals with machines, and those machines filter large populations into more manageable groups. Unless something goes haywire in the workforce – an outbreak of kleptomania, say, or plummeting productivity – the company has little reason to tweak the filtering model. It’s doing its job – even if it misses out on potential stars. The company may be satisfied with the status quo, but the victims of its automatic systems suffer.

The majority of job applicants, thankfully, are not blackballed by automatic systems. But they still face the challenge of moving their application to the top of the pile and landing an interview. This has long been a problem for racial and ethnic minorities, as well as women.

In the US, some 72% of CVs are never seen by human eyes. Computer programs flip through them

The ideal way to circumvent such prejudice is to consider applicants blindly. Orchestras, which had long been dominated by men, famously started in the 1970s to hold auditions with the musician hidden behind a sheet. Connections, reputations, race or alma mater no longer mattered. The music from behind the sheet spoke for itself. Since then, the percentage of women playing in major orchestras has leapt by a factor of five – though they still make up only a quarter of the musicians.

The trouble is that few professions can engineer such an evenhanded tryout for job applicants. Musicians behind the sheet can actually perform the job they’re applying for, whether it’s a Dvořák cello concerto or bossa nova on guitar. In other professions, employers have to hunt through CVs, looking for qualities that might predict success.

As you might expect, human resources departments rely on automatic systems to winnow down piles of résumés. In fact, in the US, some 72% of CVs are never seen by human eyes. Computer programs flip through them, pulling out the skills and experiences that the employer is looking for. Then they score each CV as a match for the job opening. It’s up to the people in the human resources department to decide where the cutoff is, but the more candidates they can eliminate with this first screening, the fewer human hours they’ll have to spend processing the top matches.

So job applicants must craft their résumés with that automatic reader in mind. It’s important, for example, to sprinkle the résumé liberally with words the specific job opening is looking for. This could include previous positions (sales manager, software architect), languages (Mandarin, Java), or honours (summa cum laude). Those with the latest information learn what machines appreciate and what tangles them up, and tailor their applications accordingly.

The result of these programs is that those with the money and resources to prepare their résumés come out on top. Those who don’t take these steps may never know that they’re sending their résumés into a black hole. It’s one more example in which the wealthy and informed get the edge and the poor are more likely to lose out.

So far, we’ve been looking at models that filter out job candidates. For most companies, those models are designed to cut administrative costs and to reduce the risk of bad hires (or ones that might require more training). The objective of the filters, in short, is to save money.

HR departments, of course, are also eager to save money through the hiring choices they make. One of the biggest expenses for a company is workforce turnover, commonly called churn. Replacing a worker earning $50,000 a year costs a company about $10,000, or 20% of that worker’s yearly pay, according to the Center for American Progress. Replacing a high-level employee can cost as much as two years of salary.

Naturally, many hiring models attempt to calculate the likelihood that a job candidate will stick around. Evolv, Inc, now a part of Cornerstone OnDemand, helped Xerox scout out prospects for its call centres, which employ more than 40,000 people. The churn model took into account some of the metrics you might expect, including the average time people stuck around on previous jobs. But they also found some intriguing correlations. People the system classified as “creative types” tended to stay longer at the job, while those who scored high on “inquisitiveness” were more likely to set their questioning minds towards other opportunities.

One model can predict when a star employee is likely to change jobs and say when it’s the right time to make an offer

But the most problematic correlation had to do with geography. Job applicants who lived farther from the job were more likely to churn. This makes sense: long commutes are a pain. But Xerox managers noticed another correlation. Many of the people suffering those long commutes were coming from poor neighbourhoods. So Xerox, to its credit, removed that highly correlated churn data from its model. The company sacrificed a bit of efficiency for fairness.

While churn analysis focuses on the candidates most likely to fail, the more strategically vital job for HR departments is to locate future stars, the people whose intelligence, inventiveness, and drive can change the course of an entire enterprise. In the higher echelons of the economy, companies are on the hunt for employees who think creatively and work well in teams. So the modellers’ challenge is to pinpoint, in the vast world of big data, the bits of information that correlate with originality and social skills.

A pioneer in this field is Gild, a San Francisco–based startup. Extending far beyond a prospect’s alma mater or résumé, Gild sorts through millions of job sites, analysing what it calls each person’s “social data”. The company develops profiles of job candidates for its customers, mostly tech companies, keeping them up to date as the candidates add new skills. Gild claims that it can even predict when a star employee is likely to change jobs and can alert its customer companies when it’s the right time to make an offer.

But Gild’s model attempts to quantify and also qualify each worker’s “social capital”. How integral is this person to the community of fellow programmers? Do they share and contribute code? Say a Brazilian coder – Pedro, let’s call him – lives in São Paulo and spends every evening from dinner to one in the morning in communion with fellow coders the world over, solving cloud-computing problems or brainstorming gaming algorithms on sites such as GitHub or Stack Overflow. The model could attempt to gauge Pedro’s passion (which probably gets a high score) and his level of engagement with others. It would also evaluate the skill and social importance of his contacts. Those with larger followings would count for more. If his principal online contact happened to be Google’s Sergey Brin, say, Pedro’s social score would no doubt shoot through the roof.

But models like Gild’s rarely receive such explicit signals from the data. So they cast a wider net, in search of correlations to workplace stardom wherever they can find them. And with more than six million coders in their database, the company can find all kinds of patterns. Vivienne Ming, Gild’s chief scientist, said in an interview with Atlantic Monthly that Gild had found a bevy of talent frequenting a certain Japanese manga site. If Pedro spends time at that comic-book site, of course, it doesn’t predict superstardom. But it does nudge up his score.

That makes sense for Pedro. But certain workers might be doing something else offline, which even the most sophisticated algorithm couldn’t infer – at least not today. They might be taking care of children, for example, or perhaps attending a book group. The fact that prospects don’t spend six hours discussing manga every evening shouldn’t be counted against them. And if, like most of techdom, that manga site is dominated by males and has a sexist tone, a good number of the women in the industry will probably avoid it.

Despite these issues, Gild’s category of predictive model has more to do with rewarding people than punishing them. It is tame compared with widely-used personality tests that exclude people from opportunities. Still, it’s important to note that these hiring models are ever-evolving. The world of data continues to expand, with each of us producing ever-growing streams of updates about our lives. All of this data will feed our potential employers insights into us.

Will those insights be tested, or simply used to justify the status quo and reinforce prejudices? When I consider the sloppy and self-serving ways that companies often use data, I’m reminded of phrenology, a pseudoscience that was briefly popular in the 19th century. Phrenologists would run their fingers over the patient’s skull, probing for bumps and indentations. Each one, they thought, was linked to personality traits. If a patient was morbidly anxious or suffering from alcoholism, the skull probe would usually find bumps and dips that correlated with that observation – which, in turn, bolstered faith in the science of phrenology.

Phrenology was a model that relied on pseudoscientific nonsense to make authoritative pronouncements, and for decades it went untested. Big data can fall into the same trap. Models like the ones that red-lighted Kyle Behm continue to lock people out, even when the “science” inside them is little more than a bundle of untested assumptions. •

Mail illustration: Nathalie Lees

This essay is adapted from Weapons of Math Destruction: How Big Data Increases Inequality and Threatens Democracy, published by Allen Lane on 6 September

• Follow the Long Read on Twitter at @gdnlongread, or sign up to the long read weekly email here