The Statistical Theory of Shelving