Setting WIP limits

Applying Lean methods to optimize the flow of a system, one encounters advice to limit the work in progress (WIP) to help keep things moving. I've wondered whether there's some simple way to take an educated guess as to what WIP limit would be appropriate. I found such a strategy (sources below). 

The number of arrivals and departures from a given state should be equal. If they deviate from each other, tuning the WIP limit can bring them into line with each other.

I know enough to know that my understanding of lean is of the "enough to be dangerous" variety, but I'm pretty sure that in summarizing this I've avoided the pitfalls described in these sources: