Use a 6-foot-long straight edge to locate the sags in the floor. Start it at the highest point of the floor and then slowly spin it around the floor in a 360-degree arc. The sagging areas are readily visible under the straight edge and this is where the repair must be focused.
Pull up the floorboards in the areas affected by sagging so you have access to the joists and the subfloor.
Lay down an additional layer of plywood over the existing subfloor and anchor it to the floor joist with a drill. This elevates the floor by the width of the plywood. Use a level as you do this to help verify the plywood is level before replacing the floorboard.
Slide roofing shingles into any gaps between the floor joist and the subfloor. This corrects smaller indentations in the floor and the shingles work as shims.
Apply a self-leveling compound to larger areas of sagging where joists aren't readily accessible. Mix the compound with water in accordance with package's instructions and pour it over the sagging subfloor. As it pools into the area that is sagging, smooth it out with a trowel and use a level to verify you've added enough to straighten the floor. It takes at least an hour to dry but once it hardens, that area of the floor should be level because the indentation is filled in.
Lay the floorboards back down over the subfloor and resecure them with flooring nails.