If you earn a decent income but have trouble saving, the culprits could be the roof over your head and the car in your driveway.

Retirement savers who contribute more to their 401(k)s often spend less on housing and transportation than their peers, according to a study by the Employee Benefit Research Institute and J.P. Morgan Asset Management.

Better savers also spend less on food and drink, but housing and transportation are bigger expenses that tend to be less flexible. Once you commit to a place to live and a car payment, you are typically stuck with those expenses for a while.

"It may be decisions that you're making as you are building your life that will ultimately crowd out saving for retirement," said Katherine Roy, chief retirement strategist for J.P. Morgan Asset Management.

The researchers divided 10,000 households into three groups: the 25% who contributed the least to their retirement plans, the 25% who contributed the most, and the "middle savers" whose contributions landed them in the middle 50%. High savers, not surprisingly, had higher incomes than the other two groups. Middle and low savers had similar incomes, but middle savers contributed about 5% at the start of their careers while the low savers contributed about 2%.

That 3 percentage-point difference in contributions is largely attributable to the lower savers spending more on housing, transportation, and food and beverage, the researchers found. By retirement age, middle savers had accumulated savings equal to twice their salaries. Low savers had accumulated about half as much.

Driving older vehicles and owning a modest home are the top two sacrifices cited in a study of Principal Financial Group customers ages 20 to 54 who contribute big chunks of their income to retirement accounts.

Both studies have their limitations. Perhaps the biggest one is that the researchers studied only people who had access to workplace retirement plans. Before the pandemic, 55 million working Americans lacked such access, according to Georgetown University Center for Retirement Initiatives. Access makes a huge difference: AARP found that people are 15 times more likely to save for retirement if they have access to a payroll deduction plan at work.

The researchers also didn't factor in the cost of living, which varies widely across the country. Living expenses are 46% higher in San Francisco than in Portland, Ore., for example.

People's personal costs of living matter hugely as well. Someone with health problems and lousy insurance likely will have more of their income eaten up by medical bills than someone in excellent health who has good coverage. The number of people you have to support — children, elderly parents, for example — affects how much you can save. People with student loan debt have less discretionary income than those whose parents paid for college. And so on.

Income matters, of course. Some people save on small incomes, while others don't on large ones. But the more money you make, the easier it is to save.

In other words, any number of factors — such as, say, losing a job during a pandemic — can affect someone's ability to save.

When you do have a choice, though, choose wisely.

"Often in our financial wellness programs, we lead with, 'You need to have a budget' or 'Don't have that Starbucks cup of coffee,' " Roy said. "I think it's more fundamental than that."