IMO if the dog was on it's owners property you made a mistake. Yelling a someone's dog on their property is inappropriate. Next time steer clear, if the dog advances on public space then you have the full right to protect yourself. While on the property, the dog is acting in a natural way to protect his territory from a perceived threat, YOU.