Earnings at major food companies in 2015 were erratic.

Even as share prices of consumer packaged foods companies generally performed well in 2015, buoyed by a variety of forces, investment analysts said the sectors fundamentals remain challenged when it comes to a most basic ingredient of long-term business success — consumer demand.

“It was a very tough year for the U.S. food industry largely because volumes were very challenging,” said Farha Aslam, an analyst with Stephens, Inc., New York.

While volumes have been under pressure for several years, an improved economic environment had generated confidence that the slump in food demand would reverse.

Farha Aslam, analyst with Stephens, Inc.

“As their incomes improved and oil prices came down, the consumer has chosen to spend their money outside the grocery stores on products like technology rather than incremental food volumes,” Ms. Aslam said. “Given you had rising income and lower fuel prices, there were expectations the consumer would spend some of the incremental discretionary funds back into food. That really wasn’t the case. Volumes and top line of food companies were challenged in 2015.”

Somewhat in contrast to the disappointing top-line results, earnings at major food companies in 2015 were erratic. While the sales trends were a drag, a number of factors helped lift profits.

Companies benefited from declining commodity costs, active cost saving programs and often an improving product mix, Ms. Aslam said.

“Merger and acquisition activity also helped,” she said. “Companies took their strong cash flows and made accretive acquisitions that helped sustain growth.”

Similar dynamics are likely to be in play in 2016, Ms. Aslam said.

“We anticipate continued challenges for volume in the case of companies selling into the center of the store,” she said. “Commodities should remain a tailwind. Benefits could accelerate as the year progresses. We anticipate continued product mix focus into higher margins products and increased efforts on pricing discipline and finally, continued focus on m.&a. as a source of growth.”

From an investor perspective, food company shares remained attractive in an equity market shaken by global economic insecurity.

“Investors sought stability in U.S. food companies because of their stable product lines, strong cash flows and good dividends,” Ms. Aslam said.

In the event economic conditions improve and global stock prices gain momentum, food company shares “may be more challenged in terms of relative performance,” Ms. Aslam said.

She emphasized the importance of additional merger and acquisition activity for the food industry, both to improve financial results for companies in the industry and to maintain strong stock market valuations.

The disconnect between share price performance and earnings growth also was emphasized by Eric Katzman, an analyst with Deutsche Bank, New York. He especially noted the importance of merger and acquisition activity in reconciling this disconnect.

“Every company at the moment is confronting the reality of a very difficult landscape — a changing landscape, full of companies doing a lot of strategic things,” he said. “Those changes are being highly valued by the market. That’s why food stocks have outperformed the S.&P.

“Most obvious is the merger between Heinz and Kraft (Kraft Heinz Co., Pittsburgh). There you have big getting bigger. On the flip side you have ConAgra (Foods, Inc., Omaha) in the process of splitting apart.

“Somewhere in the middle is Flowers (Foods, Inc., Thomasville, Ga.), that has made a number of smaller but strategically logical acquisitions to change their portfolio around.”

Beyond efforts of investors to “try to get ahead” of the changing landscape and prospects for consolidation, management teams have been hard at work in an effort to better position their companies for this change. These initiatives include deep cuts and steps in recognition of changing consumer attitudes and purchasing patterns, Mr. Katzman said.

“On a fundamental basis we think the group is fairly to slightly overvalued,” he said. “Fundamental steps have not been enough so far to get volume to grow, which is critical to the industry. What will happen in 2016 remains to be seen. We think you’ll see stabilization after six to seven years of decline in sales volume. From an m.&a. standpoint, I think it’s almost inevitable that the industry consolidates. Whether that creates value in the long term remains to be seen.”

A critical part of corporate repositioning in the food industry must be adjusting top-line growth forecasts, Mr. Katzman said.

“To assume you are going to grow at the same rate you were growing historically isn’t realistic and doesn’t lead to good outcomes,” he said. “Food companies need to lower expectations for top-line growth. They need to change products to meet with what consumers want today.”

These product changes may touch a wide range of themes, Mr. Katzman said, including health and wellness, a recognition of the increasing ethnicity in the United States, the growth of millennials and organic products.

“Those areas are where there is growth,” he said. “No one is saying it’s easy. If you want to be seen as a growth business, that focus is what is necessary.”

Traditional brands have lost equity value and have been replaced with brands like Annie’s at General Mills, Inc.

Against this backdrop of specialized areas of growth, traditional brands have lost equity value, Mr. Katzman said. Brands that have replaced this lost value include Silk within the WhiteWave Foods Co., Bridgeton, N.J., portfolio and Annie’s at General Mills, Inc., Minneapolis.

“Or any number of brands, albeit smaller and lower margin,” he said. “Any number of brands you would see if you took a tour down the aisle at Whole Foods. It isn’t that consumers have moved aggressively from brands toward private label. They have shifted from large traditional brands to smaller, newer brands.”

While meaningful, often major, cost cutting has been central in the business plans of packaged foods companies for many years, such efforts are now accelerating, said Robert Moskow, an analyst with Credit Suisse, New York.

“All of these big branded companies are coming to the realization that they need to reduce their cost structure to cope with a much slower algorithm for growth,” he said. “The early success 3G (Capital) has had in the industry with the acquisition of Heinz, brutally ripping out overhead and cutting back on spending has raised the bar for the rest of these companies. They want to make these adjustments before an activist or a private equity firm makes noise and forces them to do it. You’re seeing big restructuring programs and some new processes, particularly zero-based budgeting, implemented by the likes of Kellogg (Co., Battle Creek, Mich.), Campbell Soup (Co., Camden, N.J.) and several others.

“That’s the lens they are looking through today.”

These efforts have begun to yield positive results, Mr. Moskow said. Gross and operating margins improved in 2015 and appear likely to widen further in 2016.

“Another positive in 2015 was share price performance that was better than the market overall,” he said. “Going into 2015, every year for the past three, we’ve said that cost cutting and consolidation would keep valuations afloat, even though fundamentals, sales are not that great. This year, we kind of got it right in that sales did not grow. Margins went up. What I didn’t expect was for the stock prices to go up as much as they did.”

The prospects for improved margins do not mean easy sailing going forward for the food companies, Mr. Moskow said.

“Many companies have international exposure and are likely to face currency headwinds as a result,” he said.

The outperformance of food company shares in recent years has been driven principally by low interest rates and the perception that as they rise, they will do so “at a slower and ponderous pace,” he said.

“Secondarily, maybe 25%, is the merger and acquisition activity and the reaction of these companies to avoid becoming acquisition targets,” he said.

Because top-line sales trends have disappointed for so long, Ms. Aslam said she is looking for “self-help stories” when considering which food companies represent the most promising investment opportunities.

“Self-help stories are companies where I don’t need to depend on the consumer for them to work,” she said. “Treehouse (Foods Inc., Oak Brook, Ill.) happens to be one of our favorite names right now. They recently announced the acquisition of ConAgra private brands for $2.7 billion. It’s the largest acquisition in the history of the company and transforms it into the leading private label player in the United States. The acquisition is expected to be dilutive in year one but add 55c to 70c in year two and $1.50 to $1.65 in year three. When you consider the earnings base for 2015 is $3.10, that year three e.p.s. accretion is pretty meaningful. Annual revenue when the transaction is completed will be $7 billion, and EBITDA will be $700 million. The deal meaningfully expands Treehouse’s presence in private label, dry center of store grocery and expands its presence in the refrigerated space, where they had not played before.”

While recognizing the risk of acquisitions (the private label business Treehouse is acquiring performed poorly at ConAgra Foods), Ms. Aslam said her confidence about Treehouse is bolstered by the company’s strong track record of buying and integrating companies.

“That’s how they’ve grown from $500 million a decade ago to about $3 billion in 2015,” she said.

The slump in commodity prices since the middle of 2014 creates a promising market environment for The J.M. Smucker Co., Orrville, Ohio, Ms. Aslam said.

“They are enjoying extraordinary commodity tailwinds,” she said. “Their largest core business is coffee, and coffee prices are down about 20% to 25% year over year. They are implementing their own zero-based budget cost cutting program.”

She also is a fan of the Smucker acquisition in May 2015 of Big Heart Pet Brands for $5.8 billion.

“We think Big Heart adds another leg of growth to the Smucker story,” she said. “Big Heart has the leading position in the $2.1 billion pet foods and snack category. They are No. 1 in pet snacks with Milk Bones, No. 2 in dry cat food with Meow Mix and are expanding into the premium dog food segment with Natural Balance.

“The company is well positioned to deliver three years of double-digit e.p.s. growth, has a stable core business, synergy realization coming from Big Heart, growth from the Big Heart business, and deleveraging and share repurchases.”

Coffee also is the principal reason Mr. Moskow is upbeat on prospects for Smucker.

Smucker reignited its coffee segment with the launch of Dunkin' K cups.

“They’re starting to reignite their innovation with a successful launch of Dunkin’ K cups,” he said. “They’ve also fixed their packaging sizes on Folgers to be more competitive.”

Folgers still has competitive advantages in terms of supply chain and branding versus competitors.”

Also optimistic about synergy realization, Mr. Moskow said pet food operations may be moved from the Pittsburgh area to Ohio, and the acquired company will end up with a much reduced presence in San Francisco.

Smucker has still another fan in Deutsche Bank’s Mr. Katzman.

“We upgraded the shares in February when they announced the acquisition of the pet food business,” he said. “We felt the attractive attributes of the pet food industry with a rebound of the coffee business was very value creating and wasn’t reflected.

“It was a volatile 2015, it appears that the investment community is coming around.”

Numerous factors may explain why the company has not performed more strongly over the last couple of years, Mr. Katzman said. Underperformance by Smucker’s core coffee business generated caution and pressured financial results. Family control of the company may restrain investor enthusiasm, and the lack of international presence may be seen as a negative, he said.

Another company viewed positively by Deutsche Bank is Flowers Foods, Inc., Thomasville, Ga.

“Consolidation in the fresh bread and roll category should be beneficial to margins, and that has begun to show,” he said. “I thought challenges of 2014 would moderate as commodity prices decline and integration progress would help reduce stale rates and other inefficiencies. We thought acquisitions in organic and specialty the fresh bread and roll space were logical and would add value in the long term.”

The upbeat story for 2015 hit a bump Nov. 12, after Flowers announced third-quarter earnings and lowered guidance. The company’s stock price fell $3.10 per share, or 12%. For Flowers, the double-digit move was highly unusual — the widest price change of the year. The company’s shares typically move less than 1%, up or down in a given day (median move 0.7% year-to-date in 2015), and the steady company’s stock price had experienced daily moves in excess of 4% only three times all year. Still, Mr. Katzman said the Nov. 12 drop should be kept in perspective.

“The stock price at that point was up 40% year to date,” he said. “Unless they came up with the perfect quarter, it was likely the stock would give back some of the gains. From a big picture perspective, I thought they had reasonable explanations about why they moderated their outlook. It didn’t dissuade me from the points I made earlier.”

Flowers acquired Dave's Killer Bread last year.

Ms. Aslam expressed enthusiasm over the two acquisitions completed in 2015 by Flowers — Dave’s Killer Bread and Alpine Valley Bread — two emerging leaders in the organic baked foods marketplace.

“We think they are getting into on-trend, premium brands that resonate with consumers,” she said. “The pullback in Flowers’ shares over last three months in our view creates a great entry point for a long-term investor. The issue in the fiscal third quarter, likely to continue into fourth, is that the company was not aggressive enough in their pricing compared to the category. Their competitors, including Bimbo Bakeries and Pepperidge Farm, have been much more active in taking pricing up, compared to Flowers. Flowers has highlighted one of the reasons their pricing has lagged is that they are moving into new markets, with introductory pricing to attract trial.

“I expect their average pricing will go up early next year. They have a great opportunity to improve marketing and earnings.”

More than on-trend acquisitions underpin Ms. Aslam’s investment thesis regarding Flowers.

“They are working to improve their operations,” she said. “They’ve worked to increase the efficiency of their plants. They’ve improved execution in new markets as their direct-store delivery sales force has gotten more experience. There is white space for them across the United States. We think that creates great growth opportunities for that company.”

Deutsche Bank has been wary of recommending numerous other packaged foods companies, including Campbell Soup Co., Camden, N.J.

“We’ve been cautious on Campbell Soup for an extended period and continue to be,” Mr. Katzman said. “They have made some logical steps, including restructuring to cut costs. Their hope is that with the cost cuts, that prepared snacks and global snacking and baking will drive growth. The valuation appears pretty reasonable at this point.”

Mr. Katzman also used the term “cautious” to describe the Deutsche Bank view of the principal ready-to-eat breakfast cereal companies — Kellogg Co. and General Mills, Inc.

“Our concern is that changing consumer has made the cereal business and a lot of carb-based product more difficult in terms of driving volume growth,” he said. “We could see stabilization in the market, but that’s a far cry from growth. We consider both to be fairly valued.”

A similarly wary Deutsche Bank perspective exists toward Mead Johnson Nutrition Co., Glenview, Ill.; The Hershey Co., Hershey, Pa.; and The Kraft Heinz Co., Pittsburgh.

“You could almost call it a giant, $90 billion market experiment,” Mr. Katzman said of Kraft Heinz. “Ownership clearly is taking a different approach to costs, and they target the food industry in general. We, for the near term, are questioning that strategy and impact on near-term results — whether investors are better off looking elsewhere for now.

“Their approach is to really cut promotion where it is inefficient. That makes a lot of sense. This is a competitive industry. But lots of companies are ready to fill the competitive gap. It remains to be seen how they will navigate the competitive landscape. The long-term strategy is more acquisitions. Over time, they will look for more and more deals.

“I would say, looking at the food industry, you have very high valuations relative to the market with fundamentals that are pretty challenging. One has to be pretty cautious about how and in what one invests.”

While Mr. Moskow has favored investing in companies focused more on proteins and less on carbohydrates, he cited one significant exception.

“I really like Mondelez (International Inc., East Hanover, N.J.),” he said. “The main reason is they’ve been the most aggressive in terms of reducing waste in overhead costs. They also have one of the more dramatic supply chain restructuring plans. Every time they open a new production line in an emerging market, it’s an improvement of 1,000 basis points versus domestic markets.”

Protein companies Mr. Moskow favors include Tyson Foods, Inc., Springdale, Ark., and Hormel Foods Corp., Austin, Minn.

“Consumers are giving themselves permission to eat more fat,” he said. “I think that’s due to shifts in thinking from nutritionists about whether red meat is good for you or not. There is a study showing there is a greater risk of cancer from packaged meat, but the risk was minuscule, and I think it will be hard for it to gain traction. I think the meat processing industry tends to overproduce at times like this. As of now they’ve been surprisingly rational.”

Several companies are now offering antibiotic-free poultry.

A perennial overachiever that performed poorly in 2015, Hain Celestial Group, Inc., New Hyde Park, N.Y., represents an excellent investment opportunity, said Mitchell B. Pinheiro, an equity analyst at Wunderlich Securities, Philadelphia. Hain offers investors instant broad exposure to the natural and organic segment with large brands across many categories.

“Their brands resonate in multiple channels,” Mr. Pinheiro said. “They capture growth from a lot of different angles, including nearly 40% of their sales are international. It’s a great backdrop, and the stock has come down considerably in 2015, almost at the same rate that the natural retailers went down — Whole Foods and the like.”

The share price decline at Hain also coincided with softness within some of the company’s core businesses, Mr. Pinheiro said.

“Hain saw some pressure in the U.S. grocery business — dry, center-of-the store categories,” he said. “When you’re trading at a hefty valuation premium, the stock is going to be hit. Hain was trading at 19 times forward EBITDA. Now it’s down to 12, similar to what your large packaged foods stocks trade for. Here you’re getting five times the revenue growth for the same value as your larger, more mature food companies trade.”

Hain continues to enjoy growth in store perimeter categories, Mr. Pinheiro said.

“One of the more intriguing businesses is Hain Pure Protein,” he said. “Growth of antibiotic free poultry is incredible. Consumers are favoring branded products in what was typically an unbranded category: poultry, chicken, poultry. They are turning to brands because of the trust of the supply chain. Hain Pure Protein was selling 40% of its business branded three years ago, now it’s 60%. That’s obviously a positive for margins. It’s a reason Hain is one our favorite ideas.

“Places where it is struggling are pretty good brands — Arrowhead Mills, which is organic baking mixes; DeBoles, which is organic and natural pasta. Conventional retailers like Kroger are doing a good job in center of the store on baking mixes and pasta in natural and organic. It’s easier to replicate as a conventional grocer looking for more natural and organic items, it’s easier to replicate in a center-of-the-store business than on the perimeter.

A longtime fan of Boulder Brands, Mr. Pinheiro said the pending acquisition of the business appears like a good move by Pinnacle Foods, Parsippany, N.J.

Like Hain, Boulder experienced challenges in 2015, which pressured the company’s stock and made it an attractive takeover target, Mr. Pinheiro said.

“Boulder had a rough 2015,” he said. “It was driven primarily by increasing competition in gluten-free, which has slowed. Smart Balance, their most important category, is down 15%.”

Mr. Pinheiro attributed the challenges experienced by Smart Balance, a maker of vegan buttery spreads, to a bifurcation within the category. As Boulder looked to add value to Smart Balance with attributes such as non-G.M.O., space saving packaging and higher oil content, the leader in the category, Unilever, has taken a different tack. He said the I Can’t Believe It’s Not Butter has been adjusted with lower prices and value formatting (lower oil content, higher water).

Boulder Brands struggled in 2015 with its gluten-free Udi’s and Glutino brands.

“Boulder didn’t have the money to spend to communicate what they are doing,” Mr. Pinheiro said. “No one knows they are non-G.M.O., unless you are reading the package. No one knows they are 66% oils, which is the equivalent of butter and makes the spread good for cooking. That was their major problem.”

Another front on which Boulder Brands struggled in 2015 was in its gluten-free Udi’s and Glutino brands.

“It wasn’t one particular competitor, but it was injury by a thousand cuts,” he said. “They’re getting more competition in cookies, more competition in bread, more competition across the board. They were focused more on increasing distribution than in protecting their flanks. They’ve slowed down a little bit, and putting a little more marketing focus on their existing business. In the last quarter, they started showing some positive results. The bread business is improving — they are getting back shelf space. Gluten-free is still growing, part of the ‘free from’ trend, and for celiacs is extremely important. Udi’s is an excellent brand that sells well across categories as well as across channels. It sells in Whole Foods as well as Kroger. It sells in cookies, pizza and breakfast sandwiches, and of course in bread. It reminds me of Healthy Choice, which became a lifestyle brand. Udi’s could use Pinnacle’s scale in terms of marketing. I think these have been underinvested brands that Pinnacle is getting. They bought it at a very fair and reasonable price. It was a great deal for Pinnacle in a great category.”