Density functions of residence times for deterministic and stochastic compartmental systems.