For "attributable earnings" for excess contributions to a (Roth) IRA, what exactly does "attributable earnings" mean?

I have a three-year-old Roth IRA with different assets. I accidentally over-contributed an excess of $4600 to my Roth IRA this year, because I only made $900 in wages the entire year (I'm a student living on financial aid).

I am instructed to "remove the excess contribution and any earnings attributable", but "attributable" can be interpreted very differently.

I purchased new assets with that $4600, assets that did not perform as well as assets already in my portfolio. If I say the (negative) earnings of *those* assets that I purchased with that money is "attributable", I will remove about $4400 dollars from my Roth. If I say the *entire Roth's earnings* is attributable, I will remove about $5000 from my Roth.

In other words, is the earnings of *those assets purchased with the excess contribution* "attributable"? Or am I supposed to pretend the contribution was evenly spread over *all* the assets in the portfolio.

What is the LEGALLY CORRECT interpretation of the rule?