It's been a while since I've been yelled at, and yelled at by a sane person. I really cannot remember the last time I was yelled at outside of childhood and jobs involving customer service.
If someone sane yelled at my today, I would be genuinely shocked. I don't conduct myself in ways that would entail being yelled at, and I don't work in an environment where yelling would be considered acceptable behaviour.
Anyway, remembering my customer service days, it's often immediately obvious that the yeller is having a bad day/week/life. If you're yelling and I have to stop and assess whether you have a legitimate reason to be yelling, then you do not have a legitimate reason, and yelling without reason lacks dignity so I go into calm and receptive mode. I will try and get the yeller to calm down, mainly by not responding with more noise. Instinctively, I feel a need to balance the situation, so I react by trying to calm the situation, figure out what they want, and send them away in a subdued state. In my experience, yellers are often in some kind of distress, usually mild but sometimes acute.
On the other hand, if the yeller is one of those entitled, conceited, self-involved brats who yell because they never acquired proper manners, then I do the above, but I retract warmth and generosity and turn up the infuriatingly polite, robotic, by-the-book shtick.
If the yeller is a friend and they're trolling me, then I yell right back. If I'm in fighting trim shape, I yell out something that will embarrass them.