After succumbing to the “Great Recession” ten years ago, the stock market has made a comeback. So, does that mean you should forget about buying a new house and invest in stocks instead? The answer to that question, say experts, depends on your investing savvy, your financial discipline, your age, and your current financial situation.

The first question you need to ask yourself is, “Am I disciplined enough to invest in stocks?” According to two professors who recently studied 30 years of personal-finance performance, you need to be someone with exceptional financial discipline if you want to earn real money in the stock market. Or, you could simply buy a house.

When you buy real estate, the down payment and monthly mortgage payments force you to set aside a significant amount of your earnings on a regular basis. It’s automatic. But if you can’t summon the same discipline to invest that same amount of money in the stock market on an equally regular basis, then stocks are probably going to be a losing proposition, according to the professors’ study.

“We find that if people don’t invest all the money, actually about 90% of the time, you’re better off buying real estate,” says Professor Eli Beracha, co-author of the study.

Other issues that make stock investing risky

Investing guru James Altucher wrote a column in The Wall St. Journal titled, “8 Reasons You Stink at Trading Stocks.” In it, he argues that most non-professionals don’t have the investing savvy required to be successful in the stock market. Here are a few telling excerpts:

“Nine out of 10 people think they are above-average drivers. Nine out of 10 people think they are above-average investors. Both are mathematically impossible.”

“Most people sell at the bottom and buy at the top—the opposite of what you want to do as an investor—because they let emotions get in the way of patience and strategy.”

“It’s really hard to own stocks. It’s not just picking a stock and watching it go up 1,000%. It’s buying it and sometimes watching it go down 80% before it ends up rising 20% above your purchase price. It’s waiting. It’s patience. Psychology is at least 80% of the game. And knowing when to sell? Even harder.”

Age matters

When you’re young, many financial advisors encourage investing in things like individual stocks. With a long career ahead, you have time to wait for any bad investments to turn around before you may really need the money. But once you’re a little older, with a family, and starting to focus on your financial future, that’s when advisers recommend you buy things like real estate—a conservative investment with a long history of stable, predictable earnings.

The type of loan you choose also makes a difference

If you want to both own a home and invest in stocks, consider a 30-year home loan, which will significantly reduce your monthly payments and leave you with extra money for playing the market. (Just remember the tradeoff: You’ll end up paying thousands of dollars more in interest over the life of the loan.)

If you don’t have a burning desire to play the stock market, choose a 15-year home loan. You’ll pay less interest over the life of the loan, you’ll build equity faster, and, obviously, you’ll be mortgage-free 15 years sooner.

The tax advantages of owning real estate

As a homeowner, you’re entitled to a bevy of tax benefits you don’t get as a stock investor. You can deduct your mortgage interest and property taxes from your annual tax return. Plus, depending on your circumstances, you could also get a deduction or credit for any home-office expenses, moving expenses, capital gains, any “points” used to lower your interest rate, and more.

One caveat: investing in real estate takes time

No matter what some of those reality TV programs show, buying a home should not be viewed as a get-rich-quick scheme. But if you think you’re ready to put down roots for as long as seven years, chances are very good that any home you purchase will appreciate significantly during that time (even if the economy runs into some bumps along the way).

The non-financial benefits

Of course, not all of the benefits of owning a home are financial. For most Americans, their home is a source of tremendous pride, comfort, security and freedom. Most of us also use our homes to showcase our personality, through paint colors, furnishings, landscaping, yard signs, holiday decorations and so much more.

Yes, the stock market is on an upswing currently (depending on the week), but if you want an investment with a long-term track record of consistent returns—plus tax breaks and a variety of personal perks—you may want to buy a home instead.

If you have questions about the buying or selling process, or are looking for an experienced agent in your area, connect with me.