I was too late to save TWF (I think the voting stayed open longer than necessary, frankly) but let's see if we can't save Rapid Shot.
If the damage of your secondary attack is at least EQUAL to the damage of a single attack (such as two identical arrows), then you are better off making TWO attacks if the number you would need to roll on the d20 for a single attack (after all bonuses/penalties are factored in) is 17 or less.
A single attack that has to roll at least a 17 has a 20% chance of hitting, thus averaging 20% of your weapon's average damage each round.
Two attacks at -2/-2 would each have to roll at least a 19, for a 10% chance of hitting, averaging 10% + 10% (20%) of its average damage each round.
In other words, to make it even simpler, ask yourself: Can I hit this creature if I roll a 17 or less? If yes, attack twice.
In the case of TWF:
If the damage of your secondary attack is at least HALF of the damage of your primary attack (and almost all light weapons will actually do a little better than half), then you are better off making TWO attacks if the number you would need to roll on the d20 for the single attack (after all bonuses/penalties are factored in) is 15 or less.
To make it even simpler, ask yourself: Can I hit this creature if I roll a 15 or less? If yes, attack twice.
And finally,
If the opponent's AC is so high you need to roll a natural 20 to hit anyway, then you are always better off making TWO attacks.