People love dogs. We feed them lobster, take them to spas, sleep with them in our beds, buy them sweaters and booties, and delight in all but their pooping. To those with no canine, this adoration appears absurd, expensive, and gross. The investment, though, may be worth it. Dog ownership, new research shows, is a form of natural insurance offering health and longevity, along with the affection of an animal companion.

A study published in the journal Scientific Reports on Nov. 17 analyzed data on the health of 3.4 million Swedes over 12 years and compared it to data about dog ownership on the required national pet register. Of the millions of Swedes’ whose health records were analyzed, 13% owned canines, and of those, the dog owners between 40 and 80 years old tended to live longer than those in a similar age group who did not own dogs.

One of the study’s authors, epidemiologist Tove Fall of Uppsala University, summarized the findings for Quartz in an email, stating, “In the general population (both single and nonsingle), dogowners were at 20% lower risk of all-cause death and for 23% lower for cardiovascular death during the 12-years of follow-up.”

In particular, dog ownership was linked to a lower risk of dying of heart disease. The researchers offer the theory that dog owners live longer because canine pets provide a sort of social support and motivation for their humans to be more physically active. As a result, the researchers posit, dog owners went out more and had added social interaction than those without dogs.

Further, for people living alone, dog ownership showed dramatic health benefits. Other studies have found that living alone leads to increased risk of heart disease. In this analysis, single dog owners had a 33% reduction in risk of death generally and 11% reduction in risk of heart disease compared to single people without dogs.

The team behind the Swedish study also observed a link between hunting breed ownership and heart health, which was unexpected. Among canine owners, those who had terriers, retrievers, and scent hounds had lower rates of cardiovascular disease than owners of other dog breeds. But the statistical tie might have more to do with the lifestyles that those kinds of dog owners have, where they live—out in the country, rather than the city, say—and other factors, rather than anything specific to the actual breed of the dog.

There are other caveats to these findings. The study notes that a much smaller Norwegian study of the same subject, undertaken with similar methods, didn’t show a link between dog ownership and lower mortality. The Swedish team believes their results are reliable, however, because the sample size was so large. That said, when they looked at a subset of Swedes—42,000 twins engaged in an ongoing national analysis—they didn’t find a notable tie between dog ownership and longer life. They did note, however, that, for whatever reason, twins seemed to live in fewer one-person households.

In addition, the researchers were hesitant to assert conclusively that the habits surrounding dog ownership lead to health. There could be other reasons for the link between longevity and canine companionship. “Our observational study cannot provide evidence for a causal effect of dog ownership on cardiovascular disease or mortality,” they write. Other explanations include effects of the dog on the bacterial microbiome in the owner, for example.