Legal Precedent: A Theoretical and Empirical Analysis