how are unearned runs determined?
A run is counted as unearned when: A batter reaches base on an error (including catcher's interference) that would have retired the batter except for the error, and later scores a run in that inning by any means. ... A batter reaches first base on a passed ball (but not a wild pitch) and later scores.