Well it simply depends on the scenario of the given agency/unit. In the Navy an O-6 may very well have a "Major" command that still doesn't involve more than 180 people and an individual ship.
Likewise just as D.C. has peculiar effects on the military rank of typical workers, so does it have peculiar effects on the civilian grade of workers, due to the position classification principle of "scope of effect".
I'm less familiar with the Navy than I am with the Army and the Marines, but wouldn't the captain of a ship with a crew of 180 warrant a sizable paycheck in the private sector? I began by talking about the number of personnel they would be responsible for, but someone else described the situation a bit better than I. AS they said, it really comes down to the level of responsibility. The government probably determined that being the captain of a ship worth tens of millions of dollars is probably roughly equivalent to leading a brigade of infantrymen.
But the Navy normally uses O5 to command ships of similar crew size. Very rarely, even O4... it all depends on what exactly the ship is, and what the expected mission set of that ship is.
Obviously the Navy wouldn't slot a random O4 into minesweeper command even though it's a small ship, so you're really talking about a "better than average" O4 even for those, it just reflects back to how scope of responsibility can change things even for the Navy.
Likewise just as D.C. has peculiar effects on the military rank of typical workers, so does it have peculiar effects on the civilian grade of workers, due to the position classification principle of "scope of effect".