Dogs don’t act at random any more than people do. Yes, there’s a reason you keep buying soy sauce at the grocery store, even though you did it last time, and maybe even the time before that.
We’ve been trained by a hundred years of psychology to invent really complex reasons that we do things. Our grocery shopping behavior is linked to our happy childhood memories of eating around the table, or our unhappy childhood memories of skipping meals. And it is. But, it’s much more pragmatically linked to the fact that we’re stressed and keep forgetting the grocery list.
Your dog offers behaviors for a reason. It’s important to remember that. It’s also, however, important to let it go.
For example: Silas is barking out the window. He’s barking out the window because there are people outside, and that stresses him out. He’s an anxious dog with a history of awkward relationships with strangers, due to genetic influences on his temperament and maybe too little socialization.
Alternatively: he’s barking because he finds this behavior rewarding. He’s hoping that if he barks at them (behavior) that they will go away (reward).
The first construction of this is a very compelling narrative, and truthful as far as I know. In the grand scheme of things, it might even give me some useful training data. It tells me that I should keep exposing Silas to new people, and do everything I can to keep his anxiety level down. It’s not nearly as much help with the actual behavior in the moment, though, as the second construction. That second narrative helps me to recognize that barking is self-rewarding, and that if I want it to stop I will need to somehow intervene in that moment.
As a training tool, the big picture ultimately matters very little compared to watching the response/reward pattern. That’s good, because it’s also easy for our deep psychological reasons to be entirely wrong. We are not inside our dog’s heads. More dangerously, those same unverifiable psychological explanations often become excuses. “The dog poops on the floor while I’m at work to spite me for leaving him, so I can’t do anything about it.” “He was abused; he’ll always bark at men.”
How about this: your dog pees on your rug, eats your trash, chews your shoes, hides when you vacuum, and barks at strangers because he finds it rewarding to do so. Behaviors that are rewarded increase in strength and frequency, whether your dog is a singleton puppy with genetic fear issues or the most confident show-dog in the ring. There’s a narrative you can act on, rather than just feeling sorry about.