Margee Kerr and a friend. (Image courtesy of Margee Kerr)

This article originally appeared on Motherboard.

Deep in the basement of Pittsburgh’s haunted house attraction Scarehouse, Death awaits. Standing next to a coffin dressed in his large black coat, scythe in hand, he explains that you must meet your fate—either you or your companion must be buried. Suddenly, you’re whisked into the satin-lined box, the door shut above you. Your companion is dragged away, nowhere to be heard. You’re alone. There’s no way out. All is black inside the coffin.

No, this is not a normal haunted house.

That is, Scarehouse also happens to be the undercover laboratory of sociologist Margee Kerr. Kerr has long been interested in studying the science and culture of fear, and parlayed that into becoming the sociologist-in-residence at Scarehouse, where she can observe and collect data on visitors who undergo the attraction’s frights. (Under the attraction’s waivers, customers are essentially volunteering to be part of her research.) She also helps to design some of the fearsome experiences, including the aforementioned scene with Death.

Specifically, she designed that experience to test how people confront death, and handle claustrophobia. She says participants are finally released from the coffin after one minute, but that that timing is crucial; at about twenty seconds, people begin to question how long they really might be stuck, and then start panicking.

Kerr underwent similarly frightening experiences as part of the research for her new book, Scream: Chilling Adventures in the Science of Fear. In it, she walks on the roof of Toronto’s sky-high CN Tower; spends a night in Japan’s “suicide forest,” where many have ended their own lives; and explores the punishment cells in an abandoned prison, all to try and understand what happens physiologically and psychologically when we get scared, and why we like being frightened. She then used her research to help design the scenes at Scarehouse.

(Image courtesy of Margee Kerr)

For instance, in researching otherworldly experiences for her ghost hunting trip at Eastern State Penitentiary in Philadelphia, Kerr learned infrasound—inaudible sound waves of 20 hertz or less—can cause feelings of uneasiness and chills down the spine. It’s suggested that people who believe they’ve had supernatural encounters might in fact just be exposed to infrasound. Kerr, in turn, pumps infrasound into one of the spooky moments at Scarehouse. “It leaves customers with chills running down their spine,” she writes in Scream.

Those goosebumps, by the way, are also known as a piloerection, and are quite mysterious themselves. “There is the theory out there that this is sort of a holdover that other species have when they puff up and try to make themselves look big,” says Kerr. “It’s our attempt to make ourselves bigger, even though of course that doesn’t work with us because it’s just tiny little hairs. It hasn’t been proven, but that is the idea.”

Though Kerr admits her career hasn’t prevented her from being scare-proof—”I have a very sensitive startle reflex”—she does have tips on how to stop yourself from getting too frightened. “I see a lot of people do this before they go into haunted houses or even roller coasters; they say ‘I’m not going to get scared,’” she says. “And you can do that, you can kind of steel yourself against the startle response by basically putting yourself already in that state of, okay I’m just going to assume that I’m being startled constantly, so it’s not going to bother me. And some people can do that better than others.”

That said, Kerr says what scares her the most is knowing how manipulative her own brain and body can be. “Learning how the brain works and how we can change and manipulate what we feel and experience leaves me quite scared—it is an existential crisis in the truest sense. Who are we if we can control our feelings, and manipulate our memories?”

And so it all comes back full circle—perhaps what we fear most is all in our heads.

All in Your Head is a series that takes a scientific look at all things spooky and scary. Follow along at Motherboard.