In 2014, one of my family members became seriously ill. It changed the way I thought about my body. I became more aware of everything that could go wrong, and the importance of identifying potential problems early. After 10 years of not seeing a doctor, I went for a check-up.

My experience was not unusual. Recent research (pdf) by economists Itzik Fadlon of the University of California, San Diego and Torben Heien Nielsen of the University of Copenhagen examined the profound effect that the illness of someone close to you can have on your behavior. This has important policy implications, particularly in the US, where lawmakers are pushing to remove the requirement that people buy health insurance. What, besides compulsion, encourages people to look after their health?

Using Danish healthcare data, Fadlon and Nielsen found that a heart attack or stroke in a family led to a 30% increase in cholesterol testing and a 15% increase in cholesterol-reducing medication use among spouses, with similar effects on adult children. They also found that a death in the family causes people to seek out treatments that help them smoke less, drink less alcohol, and reduce their use of opioids. Non-biological children, children-in-law, and even close coworkers also changed their behavior, though the impact was not quite as large.

What’s more, these effects were persistent. Fadlon and Nielsen found that having a parent who had a stroke or heart attack explained almost 30% of the preventative healthcare spending for an adult child over the next decade. The chart below, from the paper, shows the increase in the use of statins, the most popular type of drug to lower cholesterol levels, by year for those who had a parent with a stroke or heart attack (in red) and those that didn’t (in blue).

In order to measure these effects, the economists used a unique dataset and methodology. As Fadlon and Nielsen note, the best way to test whether a sick person impacts the behavior of people close to them would be to randomly make people sick and then track whether their friends and family behave differently than the rest of the population. That, of course, is not possible. Instead, the researchers figured out a clever way to mimic that randomness.

Using government data on the healthcare practices of all Danes from 1980 to 2011, the researchers compared the health behaviors of households who experienced the same illness, but at different times. For instance, they compared health behaviors of households after someone had a stroke to similar households in which the stroke happened three years later.

“The results emphasize that health behaviors are not immutable and suggest the leveraging of family events as a window of opportunity for intervention,” Fadlon and Nielsen conclude. In other words, the period following the illness of a family member or friend is an opportunity to promote long-lasting changes in health for a wide range of people. It suggests that hospitals and doctor’s offices should be filled with information about preventive resources for patients and non-patients alike. This is the ultimate way to make the best of a bad situation.