Time with friends, colleagues, siblings, and children diminishes over the course of a lifetime. The older we get, the person we spend the most time with is the one we see in the mirror.

That’s the conclusion of a recent, fascinating analysis of data from the American Time Use Survey, an annual census by the US Bureau of Labor Statistics of how Americans spend their hours. Data scientist Henrik Lindberg combed through results from 2003 to 2015 to determine how much of that time is spent in the company of others.

Made by Henrik Lindberg

The data do not count sleep, or time with people who wouldn’t be categorized in any of the relationships shown. Time can also be counted twice: a party you attended with friends and your spouse would count for both categories.

Some of the relationships Lindberg found are intuitive. Time with friends drops off abruptly in the mid-30s, just as time spent with children peaks. Around the age of 60—nearing and then entering retirement, for many—people stop hanging out with co-workers as much, and start spending more time with partners.

Others are more surprising. Hours spent in the company of children, friends, and extended family members all plateau by our mid-50s. And from the age of 40 until death, we spend an ever-increasing amount of time alone.

Those findings are consistent with research showing that the number of friends we have peaks around age 25, and plateaus between the ages of 45 and 55. Simply having fewer social connections doesn’t necessarily equal loneliness. The Stanford University psychologist Laura Carstensen has found that emotional regulation improves with age, so that people derive more satisfaction from the relationships they have, whatever the number. Older people also report less stress and more happiness than younger people.

But the difference between a small circle of supportive, quality relationships and a nonexistent one is crucial. Forty-three percent of respondents in a 2012 University of California-San Francisco survey of older adults described themselves as lonely. That study and a larger one the following year found that socially isolated seniors were at greater risk of illness and premature death.

An interesting note: One doesn’t have to be alone to be lonely. More than half of the lonely respondents in the UCSF study lived with a partner. To feel connected to others, it seems, the number of hours spent on relationships is less important than the quality of the relationship itself.

Correction: An earlier version of this article misstated psychologist Laura Carstensen’s first name as Linda.