This is the logic behind the emergency fund—hold a couple months' expenses in fairly liquid form, like a savings account or US Treasury I Bonds, to smooth over unexpected changes in expenses and income. Establishing an emergency fund should be your first act before considering any other kind of investing.
How much money should you keep in an accessible place? To make that decision, you have to balance two opposing forces: the risk and cost of having too little, and the cost of not investing in something with a better return.
- If your emergency fund falls short, borrowing money even for a short time can be very expensive. Just watch John Oliver's bit on predatory lending to see how bad payday loan interest rates can be:
As discussed in this video and a LOT of other media (1,2,3), payday loans frequently drag the working poor into a vicious cycle of high-interest borrowing. To combat this, ideally your emergency fund would be as large as possible.
- The liquid assets in an emergency fund have generally poor returns compared to other investments. You lose out on the gains you could have made elsewhere, and this is the opportunity cost you pay for that liquidity. To combat this, ideally your emergency fund would be as small as possible.
Emergencies are, by definition, rare events. So why don't we get a couple people together to pool their resources? Congratulations, you've just invented...