U.S. stocks struggled to hold on to gains Friday and closed lower as investors analyzed statements from Federal Reserve Chair Janet Yellen on the state of the U.S. economy ahead of the long Memorial Day weekend. Yellen said it would be appropriate for the central bank to raise interest rates this year if the economy continues to improve. 

The Dow (INDEXDJX:.DJI) dropped 0.53.72 points, or 0.29 percent, to close at 18,232. The Standard & Poor's 500 (INDEXNASDAQ:.IXIC) lost 4.76 points, or 0.22 percent, to end at 2,126. The Nasdaq composite (INDEXSP:.INX) dipped 1.43 points, or 0.03 percent, to finish at 5,089.

For the week, the Dow lost 38 points, or 0.21 percent. The S&P 500, however, added 3 points, or 0.16 percent, and the Nasdaq gained 41 points, or 0.81 percent.

In her speech at the Greater Providence Chamber of Commerce in Providence, Rhode Island, the Fed chair warned that delaying action to tighten the central bank's monetary policy would risk overheating the economy.

"If the economy continues to improve, as I expect, I think it will be appropriate at some point this year to take the initial step to raise the federal funds rate target and begin the process of normalizing monetary policy,” Yellen said.

The S&P 500 financial sector edged higher following Yellen’s speech. The sector would benefit from a hike in interest rates this year. Dow component Goldman Sachs Group Inc. (NYSE:GS) was the largest gainer in the blue chip index Friday, jumping 1.5 percent.  

“Financials did decently in 2014, but they have more upside this year, especially if interest rates start to go up, which means more interest money for them -- whether it's mortgages or deposits,” J.J. Feldman, managing director and portfolio manager at Miracle Mile Advisors, told International Business Times earlier this year.

Aerospace giant Boeing Co. (NYSE:BA) led the Dow lower Friday, losing 1.7 percent, while healthcare company Merck & Co. Inc. (NYSE:MRK) lost 1.2 percent.

Ahead on next week’s economic calendar, economists will be eyeing the first revision to U.S. gross domestic product for the first quarter after the economy slowed more than expected in the first three months of the year.

Jessica Menton is a writer who covers business and the financial markets. News tips? Email me here. Follow me on Twitter @JessicaMenton.