Spring is home buying season, and many young people are grappling with whether it is best to buy or continue renting.

The burden of student debt and a shortage of suitable starter homes pose challenges for many first time buyers. However, a recent study, published by the real estate website trulia.com, indicates if they can manage the payments, it pays for most households to take the plunge.

The authors estimated the monthly cost of owning the average home—factoring in property taxes, insurance, income tax deduction benefits and the like—and compared those to comparable rental dwellings.  Across the country—including some quite expensive locales like San Francisco and New York—generally, it is less costly to buy than rent.

If a family or single individual anticipates moving to another city for a new job or perhaps plans to tie the marital knot over the next few years, closing costs, realtor’s fees and the like can wipe out those savings but you don’t have to be in a home all that long to profit nicely.

Employing a handy calculator on the site, I estimated that for the Washington metro area—with 10 percent down, a 30 year mortgage and a 4.40 interest rate—if the average home is occupied for 5 years after purchase, owning beats renting by about 11 percent. Extending the turnover period to 7 years jumps the savings of owning over renting to 23 percent.

A lot depends on what you do for a living. Most folks with stable employers don’t move between cities once they have settled in for a few years. Generally, teachers, accountants and other professionals face state licensing requirements, have family and develop social attachments, and pursue careers within regional job markets. Most folks settle in and can reasonably assess if they will want to relocate in the next few years.

Even in a period of slower economic growth, real estate has proven a solid investment.

In this century, U.S. GDP and inflation have advanced about 2 percent a year. Through the end of 2016, stocks returned, as measured by the S&P 500, about 4.5 percent annually, while homes appreciated 3.8 percent.  Those figures don’t consider that the savings homeowners accomplish over renters can be invested in an IRA or an ordinary stock account. Factoring those in should even up the returns between houses and other investments over the long run.

Beyond the numbers, the freedom to customize an owner occupied dwelling and avoid the risk of being required to move if the landlord decides to sell the property enhance the overall value homeowners obtain from their piece of the American dream.

Families may have to stretch to buy a first home or to buy up to accommodate a growing family, but is important to be sensible in estimating the size of the dwelling and amenities needed.

Children can be comfortably raised without two rec rooms, a dedicated home theater, three and a half baths and a huge back yard. And how much home you buy should be balanced against the need to save for retirement, college and other long term needs.

In particular, annual contributions to the IRA needed to retire comfortably become much larger in their middle years if families chose to buy more home than they need in their 20s or 30s. Children raised in too lavish a home may be forced to borrow a lot more to finance higher education and start out their working lives in an unnecessarily deep financial hole.

My wife and I raised a family in a moderate-sized row home in the historic district of Alexandria, albeit with a family room we added, that served multiple purposes, just 20 minutes from the White House. While we didn’t live in a mega-mansion on a huge lot, we meet a lot of interesting people walking our children to city parks.

As empty nesters, we now live comfortably in the same dwelling with the prospect of retirement in a home not too burdensome to maintain.

Bottom line: Buy a sensible home to raise your family. Hold on to it for the long haul, and it will prove a sound investment.